jQuery in Action, 3rd edition
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "query related to sessions" Watch "query related to sessions" New topic

query related to sessions


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
I agree. Here's the link: http://aspose.com/file-tools
subject: query related to sessions
It's not a secret anymore!