Be really careful with this, though--this sort of servlet-to-servlet
communication is being discouraged, especially when you consider that the
"other" servlet may (due to distribution, clustering, or load-balancing
reasons) not be in the same JVM you are. Most of the servlet literature I've
seen recommends instead doing forwad() or redirect() calls, in place of
making a call on the Servlet directly.

If you *really* want this sort of communication between Servlets, perhaps
look at RMI, CORBA, or even JSDT. (getServlet(), if I'm not mistaken, was
deprecated back in 2.0 or 2.1, but I haven't looked in a long time.)

Ted Neward
Java Instructor, DevelopMentor ( http://www.develop.com )
http://www.javageeks.com/~tneward
-----Original Message-----
From: Ron Reynolds <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, February 14, 2000 8:58 PM
Subject: Re: How can i call a servlet method from another servlet


>let me answer that with a question - how would you call that method if it
>wasn't the method of a servlet?  what if it was just another class - then
>what would you do?
>once you have the answer to that then consider that servlets are just
>classes loaded and called through a particular interface by the servlet
>engine, but they are still classes.  i know this is an over-simplification
>because it doesn't talk about session management or finding the exact
>instance of a servlet type in the servlet engine, but this didn't sound
like
>that kind of question...
>............ron.
>
>-----Original Message-----
>From: arun prakash <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>Date: Wednesday, February 16, 2000 5:01 AM
>Subject: How can i call a servlet method from another servlet
>
>
>>Hi !!,
>>
>>   I need some help out from u guys. How can i call a
>>specific servlet method from another servlet. Any
>>suggestion will be extremely helpful and a code would
>>be the best way to help me out.
>>
>>Thanks in advance.
>>arun prakash
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Talk to your friends online with Yahoo! Messenger.
>>http://im.yahoo.com
>>
>>__________________________________________________________________________
_
>>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
>
>___________________________________________________________________________
>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

___________________________________________________________________________
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