This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes WEB-INF/classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "WEB-INF/classes" Watch "WEB-INF/classes" New topic
Author

WEB-INF/classes

saqib sarwar
Ranch Hand

Joined: Mar 30, 2007
Posts: 77
I have concept that all the class files present at WEB-INF/classes are available to whole application (servlets,jsp).

but i got a strange behaviour of tomcat. when i placed "Counter.class" in classes/Counter.class location and tried to access it in JSP page at application home directory, jsp gave error of not resolving Counter class.

and when i placed Counter.class in model.* package, classes/model/Counter.class, and import package in jsp page than jsp recognized it.

why in first try jsp has not recognized the Counter.class.

Kind Regards


SCJP5 95%, SCWCD 85%<br />Knowledge is the Life of Mind
Darren Weaver
Greenhorn

Joined: Apr 30, 2007
Posts: 7
You must use a package because you cannot import classes from the default package. Here's the explanation from the JSP 2.0 spec:

As of JSP 2.0, it is illegal to refer to any classes from the unnamed (a.k.a.
default) package. This may result in a translation error on some containers,
specifically those that run in a JDK 1.4 or greater environment. It is unfortunate,
but unavoidable, that this will break compatibility with some older JSP
applications. However, as of JDK 1.4, importing classes from the unnamed
package is not valid (see http://java.sun.com/j2se/1.4/compatibility.html#source
for details).
saqib sarwar
Ranch Hand

Joined: Mar 30, 2007
Posts: 77
thanks Darren Weaver for Guidance

kind Regards
 
wood burning stoves
 
subject: WEB-INF/classes