Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sendRedirect and Session attributes

 
Abhishek Asthana
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic