User Package in JSP
hi All,
i m developing one application in which i have to create one package
and import tht in JSP bt i gives
package XYZ does not exist
.
and if i m using tht package with java application it runs perfectly
i dnt understand y this is heppning.
plz help.
Thanks in advance
# 3
> <%@ page import="XYZ.Class_name" %>
> Is this wrong way to import user package?
No , its also correct, but you can only access particular Class,
if you want to insert more than one package,
<%@ page import="XYZ.first,XYZ.secone"%>
or
<%@page import="XYZ.firstclass"%>
<%@page import="XYZ.secondclass"%>
# 4
This error message tells you that the package doesn't exist. The package is specified correctly, but it simply cannot be found in the classpath.
Doublecheck the spelling (Java is casesensitive) and doublecheck if this package is actually available in the classpath.
# 5
Ya Every thing perfect......
bt i dnt know y this happen?
Any other reason?
i kept both jsp page and java file in same folder. Is this is reason?
or wht is tht reason?
Spcify Package like
package XYZ;
and Import in JSP like:
<%@ page import="XYZ.ABC" %>
ABC abc=new ABC();
abc.show();
thanks in advance
# 6
Hmm ok, have you compiled the source file and put the class file in the classpath of the applicationserver?
Are you using an IDE or not?
# 8
This is Main Error Code
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\Dgft\verify_jsp.java:15: package XYZ does not exist
import XYZ.*;
^
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\Dgft\verify_jsp.java:110: cannot find symbol
symbol : class ABC
location: class org.apache.jsp.Dgft.verify_jsp
ABC ver=new ABC();
^
An error occurred at line: 32 in the jsp file: /Dgft/verify.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\jsp-examples\org\apache\jsp\Dgft\verify_jsp.java:110: cannot find symbol
symbol : class ABC
location: class org.apache.jsp.Dgft.verify_jsp
ABC ver=new ABC();
^
# 9
maybe tomcat can't find the package because it isn't in the classpath; did you deploy it in the webapps folder?
As BalusC said, I would advise you to use some IDE; it will make your life a lot easier!
I would advise myeclipse (free to try, cheap to buy)