You can call another servlet using the RequestDispatcher Interface.  To do
this, get hold of RequestDispatcher in first servlet like this:
RequestDispatcher
reqDispatcher=this.getServletContext().getRequestDispatcher("/servlet/second
_servlet");
Then call the forward method by passing HttpServletRequest and
HttpServletResponse objects. reqDispatcher.forward(request,response)
Doing this will pass the control to the second servlet.

-HTH


----- Original Message -----
From: Pedro Rolo <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 20, 2000 5:32 AM
Subject: Chaining servlet calls


> Hi, everyone!
>
> I'm in the process of finishing a project that is entirely based on
> servlets.
> However, there is still one feature that is missing. I am breaking the
> update transactions into 2 servlets: a servlet call that displays the data
> for the user to change and then, when the user presses the "OK" button, a
> second servlet call that updates the altered data.
> My idea is to make this updating servlet automatically call another
servlet
> to display the main screen again (which is in turn another distinct
> servlet).
> Is this possible? Can I do something like:
>
> if(update_transaction_ok)
>         call_servlet ListAllRecords;    //  <- How do I do this?
> else
>         display ErrorScreen;
>
> Many thanks in advance,
> Pedro Rolo
>
>
___________________________________________________________________________
> 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