John Doe wrote:
> Can anyone please refer me to some concrete documentation on this. I would
> really like to know if this is true: is there another thread created which
> does the redirection code, while the current thread continues executing the
> code on the current page?
>
Check the HTTP spec (RFC 2616, is the current one, if I remember right) and the
Servlet API spec (http://java.sun.com/products/servlet/download.html) for the
details.
Basically, calling response.sendRedirect("xyz") sets the HTTP response status to
301 or 302 (I don't remember which), and adds a header that includes the URL to
the new message. This response, when sent back to the browser, will cause it to
automatically issue a *new* request to the new URL.
Note, however, that the sendRedirect() method is a normal Java method that
ultimately returns to its caller -- there is no thread magic going on here. You
should include a "return" statement after calling this method in your own code.
The same rule applies when you use RequestDispatcher.forward() -- you need to
include a "return" statement afterwards. The only case where you don't is when
using <jsp:forward>, which (in effect) generates the return for you.
>
> thank you
> rostom
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets