"Bernard, Frank" wrote:

>         Craig McClanahan wrote:
>
> > "Bernard, Frank" wrote:
> >
> > > > Is it possible to write JSP code to redirect the browser to open a new
> > > > page,
> > > > say, page B from JSP code in page A?
> > > >
> > >         use:    response.sendRedirect ( target_URL );
> > >
> >
> > You can also do this on the server side (without a second round trip back
> > to the
> > client) with
> >
> >     <jsp:forward page="/targetpage.jsp" />
> >
>         <%  response.sendRedirect ( target_URL ); %>  is server side, isn't
> it.
>

It is initiated at the server side, but requires an extra round trip HTTP
transaction with the client.  The overall flow goes like this:
* Client makes the original request
* Server reads the request, decides which
  servlet or JSP page should create this
  response, and sends back a "redirect"
  response telling the client to call that
  servlet or page directly
* Client automatically follows the "redirect"
* Server sends back the actual response

Request forwarding is more like a "go to" on the server side:
* Client makes the original request
* Server reads the request, decides which
  servlet or JSP page should create this
  response, and then calls it to create
  the actual response

If the client is at the far end of a slow modem, the time difference between these
approaches can be substantial.

>
>         Frank Bernard

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to