aspose file tools*
The moose likes Servlets and the fly likes about sessions 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 "about sessions" Watch "about sessions" New topic
Author

about sessions

sureshreddy puli
Greenhorn

Joined: Sep 28, 2005
Posts: 29
HI,

I am new to servlets.Please tell me the difference between

application.setAttribute(....)
session.setAttribute(....)
request.setAttribute(....)

And exactly the need of thees three.That is when should i use each.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Refer to the servlet specs.
There is no other better substitute.
[ October 05, 2005: Message edited by: Adeel Ansari ]
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
application.setAttribute(....)
These attributes are accessable and usable throughout the life of the web application, and is shared by all sessions (a session starts when the app receives the first request from a user, and ends when they log off, close their browser, or the session expires i.e.the server does not receive requests from the user for a preset time).

session.setAttribute(....)
These attributes are accessable and usable throughout the life of a session.
They are isolated from other sessions (i.e. one user's session is completely seperated from anothers)

request.setAttribute(....)
These attributes are only valid and usable for the duration of one request (i.e. from the user requests some url, until the server has finished responding)
[ October 05, 2005: Message edited by: Scheepers de Bruin ]

We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about sessions