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

[362 byte] By [javarocktheworlda] at [2007-11-27 11:40:50]
# 1

how did you import it into your jsp?

should be:

<%@ page import="XYZ.*" %>

greetz

StijnGa at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

<%@ page import="XYZ.Class_name" %>

Is this wrong way to import user package?

javarocktheworlda at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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"%>

drvijayy2k2a at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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.

BalusCa at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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

javarocktheworlda at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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?

BalusCa at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

i m nt getting u?

can u plz explain properly...?

javarocktheworlda at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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();

^

javarocktheworlda at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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)

StijnGa at 2007-7-29 17:34:14 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...