Originally posted by Prakash Balasubramani:
Hi,
To have an object available in new page while redirecting, u can use redirect to new page as follows
response.sendRedirect(response.encodeRedirectURL(pagename))
This will send the request to new page with the same session-id so all the objects will be available in new pages too.
Hope this could be useful.
Bye,
B.Prakash.
No it won't.
Any time you use response.sendRedirect, you are mearly sending a 302 respone code to the browser along with a URL. The browser then makes a
new request to the server. Anything bound to request scope is available for that request only.
When using forward, control goes straight to the new page without leaving the server (within the same request).
Prakash,
Please read the API for encodeRedirectURL and understand what it does before telling people what they can do with it.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletRequest.html