tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JTBld...@aol.com
Subject Accessing Servlets In Packages
Date Thu, 16 Nov 2000 14:03:11 GMT
I seem to have my problem solved, but let me get this back on the mailing 
list for the benefit of the archives --

I was having trouble accessing servlets that reside in my own packages.  My 
test cases could access .class files in:
 
/usr/local/jakarta-tomcat/webapps/myWebApp/WEB-INF/classes
 
For example "SnoopServlet.class" in that subdir is accessed with:
 
http://www.mySiteName.com/myWebApp/servlet/SnoopServlet
 
Now, take a class, SomePackageClass, declared to be in package testapackage 
within its .java code file.  Its compiled form is in the following file:
 
/usr/local/jakarta-tomcat/webapps/myWebApp/WEB-INF/classes/testapackage/SomePa

ckageClass.class
 
I would like to (but CANNOT) access it with:
 
http://www.mySiteName.com/myWebApp/servlet/testapackage/SomePackageClass
 
INSTEAD, I FIND I MUST USE:

http://www.mySiteName.com/myWebApp/servlet/testapackage.SomePackageClass
 
(Note the "." notation separating the package name and class name, rather 
than a "/".)

Unfortunately, the slash notation worked with JServ, for which I have tons of 
working code, but not with Tomcat.

Thanks for others' comments related to possible addition of <servlet> tags in 
file ..../webapps/myWebApp/WEB-INF/web.xml but it looks like I'd still have 
to change all my JServ code (the calling HTML) that used the slash notation. 

Incidentally, I found a sprinkling of material pertaining to my problem in 
the new book "Core Servlets and JavaServer Pages" by Marty Hall.  This was 
published this year (year 2000) for Sun Microsystems by Prentice Hall (see 
pages 30-42).  I wish to give them a plug for this very current effort 
complete with some updates based on Tomcat 3.1.  Price is US$42.99.

John Thompson
Boulder, Colorado, USA
JTBldrCO@aol.com


Mime
View raw message