>>> Sushil Singh <[EMAIL PROTECTED]> 14-Sep-00 1:01:28 AM >>>
>Now your first question:
>>When you say "calls" I presume you mean that:
>> - the submit goes to servlet1
>> - servlet1 gets a RequestDispatcher for servlet2
>> - servlet1 forward()s the request to servlet2
>No, when I say "calls", the submit directly calls "Servlet2"
>since its specified in <Form action>.
>Servlet2 is getting RequestDispatcher for Servet1
>Servlet2 forward()s the request to Servlet1
You want the URL to reflect Servlet1 though don't you?
Why are you surprised that it reflects Servlet2?
If I setup a normal FORM from a static HTML page like this:
<FORM action="http://www.tfltd.net/somepage" ...>
and the user submits the form what is the URL displayed?
Answer: http://www.tfltd.net/somepage
So when you submit from the page to Servlet2 it is entirely natural
that the page should display as coming from Servlet2.
Remember that when you submit from the page it's not correct to say
that Servlet1 is calling Servlet2. Correctly you should say: "the page
downloaded from Servlet1 calls Servlet2".
If you want Servlet1 to appear as the URL you should have the FORM
submit to Servlet1 and inside Servlet1 detect the fact that you must
dispatch to Servlet2.
A RequestDispatcher.forward() will not show up in the browser's URL.
And you can dispatch as many times as you like (so if you have to go
from Servlet1 to Servlet2 and then back to Servlet1 that's okay).
>>1. Before redirecting to servlet 1, servlet 2 should
>>produce html which will display a popup window.
>No, since the control is in servlet2, it should return to
>servlet1 but addionally displays a popup window.
You can't do that. You can't have a servlet return two responses for
a single request.
>Now regarding forward(), if Servlet2 is forward()s to
>Servlet1, then what should be the url in the browser,
>I am seeing the url for servlet2. This result is same for
>both include() and forward().
The browser knows nothing about the forward(). As far as it is
concerned it is still talking to Servlet2. If you want to do it this
way and have the browser know you must use sendRedirect().
Nic
___________________________________________________________________________
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