> Subject: running a servlet from another servlet
>
>
> Hi
>     I was wondering if it is possible to invoke a servlet from another
> servlet and how I can do this.
>
> Thanks in advance for any suggestions, ideas
> Cheers Harald

 You have a couple of options:

1.
make an HttpURLConnection object and use it to connect to Apache via the
localhost address. You'll get back the complete http response which you'd
then have to parse etc.

2.
get a loaded instance of the servlet you want to pass the info to using
ServletContext.getServletContext. You can then call any of the public
methods of the servlet. Watch out for thread safe behaviour. - check the
source. If the server hasn't yet loaded the servlet you want then force it
to load by using HttpURLConnection. Discard the response then try to get it
from getServletContext again.

HTH
***********************************************************
Brett Knights                             626-432-5767 work
[EMAIL PROTECTED]                    626-355-1017 home
***********************************************************





----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://www.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to