Hi,
If you wants to call a servlet from another context, first you
have to create the Context object, than you can forward or
include the target servlet.
Suppose you are working in context named "one" and
you have to call servlet from context named "two".
file://creating cross-context object:
ServletContext context = getServletContext().getContext("two");
RequestDispatcher rd = context.getRequestDispatcher(servlet);
rd.forward(request, response);
One more thing you have to do is, in your
server.xml while registering contexts specify that crosscontext=true
good luck,
MHRAO
----- Original Message -----
From: "andrew tollin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 10, 2001 10:06 PM
Subject: Calling a servlet from another servlet
> Hello,
>
> Can someone tell me how to call a servlet from within another servlet.
>
> I am checking a users input in one servlet class, if the input is wrong I
> want to redirect him back to the servlet where he can re-enter the value.
If
> the input is correct I want the program to continue within that servlet.
>
> A
>
>
___________________________________________________________________________
> 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