aspose file tools*
The moose likes Servlets and the fly likes sendRedirect and Session attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect and Session attributes" Watch "sendRedirect and Session attributes" New topic
Author

sendRedirect and Session attributes

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Hi,
I wanted to know if response.sendRedirect function passes the session attributes set in the sender servlet to the called servlet?

Abhishek
Dharmanand Singh
Greenhorn

Joined: Oct 27, 2004
Posts: 13
If I got you right, you are asking if the session attributes can be accessed after you have redirected the response. As per my knowledge, only the request object dies after response redirecting (and a new request object initiated). Session object is related to the user session and attributes in the session object will not die until the session expires or you explicitly remove that attribute. Hence compiling all these, the session attributes can be accessed after setting them even after redirecting the response.
[ April 07, 2005: Message edited by: Dharmanand Singh ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It doesn't pass anything.
It just tells the browser to make a new request with the given address.
The new request will have access to the session variables because they are "session" scoped.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sendRedirect and Session attributes