>From: Manish Shah <[EMAIL PROTECTED]>
>hello everyone,
>I did go through the RequestDispatcher but....how do I
>get a direct reference to a servlet instance and call
>its methods directly.
>
>Using the deprecated getServlet method it was done
>this way...
>myLogonApp = (AppLogonServlet)
>getServletConfig().getServletContext().getServlet("mum_cs.AppLogonServlet");
>
>Please do let me know...or maybe if anyone knows some
>piece of code which used the RequestDispatcher to do
>this..or is it that it cant be done this way anymore
>in the new API and the whole program logic itself has
>to be changed...
>I really appreciate any help...
>
>Manish
>[...]
Hi :-) I am not sure, I think it is not "often-used"
to use a method of another MyServlet directly, but
perhaps you can try the following:
- in MyServlet0, put "this" in ServletContext with
setAttibute(...)
- in MyServlet1, get that Attibute, and use it, but
perhaps it is better Not to use service/doGet/doPost
of MyServlet0 in this way.
- if you have a method which will be used by more than
one MyServlet, perhaps it is better to put it in a
MyHelper class, and load this class with a classloader
which is "upper" than webapp classloader, now all the
MyServlet classes in every webapp(in the whole
webapps/container) can use it, without ClassCastException
or other.
Bo
May.07, 2001
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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