Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! servlet setting in TOMCAT 1

Status
Not open for further replies.

lordtektips

Programmer
May 20, 2001
9
0
0
AU
hi,
I've set a TOMCAT3.3 and can successfully run JSP. Can anyone tell me where to place a servlet and how to run it?
(my jsp dir is webapps/sunny in which there are two subdir /jsp and /classes)
Thank you all for helpping me!

sunny
 
You need to deploy your servlet as part of a Web Application as per Servlet Specification 2.2. So if your Web App is called sunny then the following would be the directory structure to following:
sunny/ <-- All HTML, images, and JSP. May also be broken into sub-folders
sunny/WEB-INF <-- web.xml deployment descriptor necessary to deploy Servlets.
sunny/WEB-INF/classes <-- All Servlet and supporting classes
sunny/WEB-INF/lib <-- Any additional third-party utility classes.

If you do not include a deployment descriptor then I believe Tomcat will automatically map Servlets to the servlets directory. For you example any Servlet would automatically be mapped to This is not normally the desired location and is not required to be supported by all Servlet Engines so you should explicitly set the Servlet Mapping in your deployment descriptor.

For more information on deployment descriptors and Servlets in general I suggest you pick up a copy of Jason Hunter's Servlet Programming book. You can also find information on Tomcat's website and java.sun.com has tutorials and loads of info as well. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top