This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
SCJP5 95%, SCWCD 85%<br />Knowledge is the Life of Mind
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).