Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

query related to sessions

 
Sharath
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me the difference between attributes stored in session object and attributes in a request object with a practical example ?
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Request attributes are available for only that particular request.

Session attributes are accessible and usable throughout the life of a session.
[ October 20, 2005: Message edited by: Vishnu Prakash ]
 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference is of the scope of the atribute . If you set an attribute in the request , then it will only be visible to the component having access to that request. for example


In a servlet is you set an attribute 'A'in the request and attribute 'B' in the session then attribute 'A' will be accessible to the JSP/Servlet having that request object,as http is a stateless protocol, there will be new HttpRequest for each request of any component from the server, Attribute 'B' will be accessible to all the request from same client, as all the request from the sam client will use a single session object on the server side.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic