• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WEB-INF/classes

 
saqib sarwar
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Darren Weaver
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Darren Weaver for Guidance

kind Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic