• Post Reply Bookmark Topic Watch Topic
  • New Topic

newbie question: How to import a class under /WEB-INF/classes?  RSS feed

 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If I create a class directly under the /WEB-INF/classes directory, how do I import it to my JSP program ? In short, if this class is not in any package, how does it get imported?
Thanks.
[ March 05, 2004: Message edited by: Alton Hernandez ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The short answer: Just don't do it.
Put all classes that are used in JSP or servlets in packages - you will avoid many hard to understand errors and be glad you did.
Bill
 
Alton Hernandez
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill.
I am reading a not so up-to-date book on JSP. And it seems that this is possible before. But I guess they change it now.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is still possible, using the invoker servlet which is included in the Tomcat distribution and still used in the /examples - but my advice is to go ahead and put classes in packages and avoid the invoker. People get the damnest weird errors when trying to mix the invoker approach with the current best practices in servlets.
What has changed is that the invoker is off by default in Tomcat 4 and later - books written for earlier tomcats (mine included - sigh) made use of it because it simplifies getting your very first servlet running.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!