File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes invoking servlets differently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "invoking servlets differently" Watch "invoking servlets differently" New topic
Author

invoking servlets differently

ray bond
Ranch Hand

Joined: Oct 11, 2000
Posts: 111
hello there,
I am using tomcat to run servlets , to invoke servlets in tomcat , in browser we type "http://server:80/servlet/ServletName" , but how can we invoke servlets like
"http://server:80/servlet/directoryname/ServletName" ,
where dirctoryname is the name of directory in which ServletName.class resides.
I know by setting classpath we can put servlets class in other direcotories then web-inf , but how to invoke servlet by putting servlet class in a certain directory and then invoking that servlet using that directory name in url.
e.g. "http://server:80/servlet/directoryname/ServletName"

[This message has been edited by ray bond (edited January 04, 2001).]
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
I think you will have to change the Servlet mapping for the particular Servlet in the Web.XML file to make it point to the specific directory.

I guess you'll need to restart the servlet engine.
Hope that helps!
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Ray,
We need to define 2 params in Web.xml file
Define 1. <servlet> Name </servlet>
2. Use 'Name' in <servlet-mapping> </servlet-mapping>. I just cut and paste an example came with Tomcat 3.1
[This message has been edited by maha anna (edited January 04, 2001).]
ray bond
Ranch Hand

Joined: Oct 11, 2000
Posts: 111
hello there ,
thank you very much maha for your reply , it is working
perfactly fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invoking servlets differently