>>> Sushil Singh <[EMAIL PROTECTED]> 13-Sep-00 10:51:14 PM >>>

Firstly this is a much better explanation of your problem than the
first one. That was confusing and hard to read. Posting in the way
you've done here makes it easy for us to help you.

>I am having one servlet "Servlet 1" which displays a form,
>on form submit, it calls another servlet "Servlet 2" which will do
>some process and then redirects to servlet 1 using
RequestDispatcher.

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

Yes?


>1. Before redirecting to servlet 1, servlet 2 should produce
>html which will display a popup window.

Ok. Why go back to servlet1?


>2. Its perfoming perfectly i.e. it redirects to servlet 1 and
>display a popup window. The only thing I am unable to
>understand is that still the url on browser is Servlet 2, which
>I think should be Servlet 1.

You'll have to answer the above questions before I can answer that.


>This type of scnerio is required when dealing with multiple
>websites. Here you can assume that "Servlet 1" is on one
>website and "Servlet 2" on another website.

I don't understand this.


>Also if anyone can provide difference between forward
>and include.

You could search the archives or FAQs. This has been explained many
times.

Breifly the answer is this:


RD.forward()
the whole request is forwarded to the RD target. This is generally
used when you want a servlet to do some processing on the request (ie:
get a parameter) and forward to different servlets depending on the
result.

RD.include()
includes the output of the servlet that is dispatched to (ie: the
servlet that is INCLUDED) in the output of the servlet that called
include.

so if servlet-A output this:

  <html>
  <body>
  <h1>document title</h1>

and then called rd.include() on servlet-B that output this:
  <p>Hello there!</p>

and then servlet-A output this:

  </body>
  </html>

then you would see this come back to the UA:

  <html>
  <body>
  <h1>document title</h1>
  <p>Hello there!</p>
  </body>
  </html>


See?


Nic Ferrier

___________________________________________________________________________
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