File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Path for Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Path for Servlets" Watch "Path for Servlets" New topic

Path for Servlets

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
I have JDK in c:\jdk1.2.2 and Tomcat in C:\jakarta-tomcat.
Which is proper place(folder) to keep servlet files for testing?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
By default you can put your servlet, say ExampleServlet.class, into the folder(in your case):
Then you can call your servlet in browser in this way: http://localhost:8080/examples/servlet/ExampleServlet
Of course you do not have to just put your servlet in above directory, but you have to change the .conf files and .xml files by yourself.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
However, there is an important point to consider.
If you want Tomcat to correctly deliver initialization parameters to your servlet, you must give it an alias entry in the web.xml file. We just went round&round about that on the Tomcat users mailing list.
I agree. Here's the link:
subject: Path for Servlets
It's not a secret anymore!