Hasnt this question been answered many times. ;)
When a sendRedirect() method is invoked, it causes the web container
to return a response back to the browser with information that a new URL
should be requested. Because the browser issues a completely new request,
any objects that are stored as request attributes before the redirect
occurs, will be lost. This is one of the biggest differences between a
forward and redirect.
Because of the extra round-trip that occurs, a redirect is slower than using
a forward.
One more thing. All URLs passed to the sendRedirect() method should be ran
through the encodeRedirectURL() method so that the Session ID can be
included if the browser doesn't support cookies and session tracking needs
to occur.
For further information check this out.
http://www.fawcette.com/javapro/2002_03/online/online_eprods/servlets_03_19/
Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031
-----Original Message-----
From: Senthilkumar ,T.P (CTC) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 11, 2002 12:56 AM
To: [EMAIL PROTECTED]
Subject: Calling from one page to another
Hi all,
What is the difference between getServletContext().getRequestDispatcher(),
response.sendRedirect(),jsp forward tag, include directive Everything
forwards the request to another servlet / jsp. What are the differences and
in which case I should use which method. Pls explain me / Provide the URL
TPS
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com