wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes query related to sessions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "query related to sessions" Watch "query related to sessions" New topic
Author

query related to sessions

Sharath
Greenhorn

Joined: Oct 19, 2005
Posts: 28
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

Joined: Nov 15, 2004
Posts: 1026
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 ]

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Rohan Kayan
Ranch Hand

Joined: Sep 17, 2004
Posts: 123
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.


SCWCD 1.4, SCJP 1.4
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: query related to sessions
 
Similar Threads
ServletConfig
Returning more than one value
ServletRequest or HttpServletRequest ?
Difference between a Parameter and an Attribute
html:checkbox or html:multibox