• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

WEB-INF/classes

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Darren Weaver for Guidance

kind Regards
reply
    Bookmark Topic Watch Topic
  • New Topic