hi rajesh

to call a method of one servlet from another one you need to use servlet
context feature.

in the first servlet whose method you want to access, you need to add the
folloing code lines

ServletContext context = getServletContext();
context.setAttribute("NAME",obj);
where
NAME = any name of the object containing the method
obj = object of the class whose method you want to use.

in the secod servlet you need to access it with the following line of code

abc = (name of the class containing the
method)getServletContext().getAttribute("NAME");
abc.yourMethod();

you need to keep the classfiles into your classpath

hope this will work

sayantan


Hi all,
I have basic question regarding servlets.I have a servlet which has some
member functions apart from doGet and doPost.How could I call these methods
from the other servlet.I don't want to load the servlet on my own .It should
be loaded as normal servlet from servlet engine.


Thanks...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rajesh Basawa
Professional Services, Cisco Systems, Inc.
Voice: 408-853 9557
Email: [EMAIL PROTECTED]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to