Author
Session query
Philip Zac
Ranch Hand
Joined: Apr 27, 2008
Posts: 66
hello, When I store session for example given below... And I did not set the time limit. Will it be destroyed after the computer shut down or ......?? Thanks GReen Horn [ July 24, 2008: Message edited by: Bear Bibeault ]
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
It will be destroyed when the session times out, becomes invalidated or the server is shut down. You set session life time in web.xml.
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3028
Originally posted by Philip Zac: hello, When I store session for example given below... And I did not set the time limit. Will it be destroyed after the computer shut down or ......?? Thanks GReen Horn
Paul Sturrock gave the correct answer for the session (though the session isn't necessarily lost when the server shuts down). But your code uses the request to store the attribute, not the session. In this case the object goes out of scope as soon as the request is complete.
Steve
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
Originally posted by Philip Zac: When I store session for example given below...
The code you posted does not store anything is session scope. You've stored the object in request scope.
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Agarwal Priyanka
Greenhorn
Joined: Jul 25, 2008
Posts: 20
posted Jul 27, 2008 12:20:00
0
this code is only used to set/store the attributes, not the session object. You need to add... to get a session,and to set the attribute in the session. [ July 27, 2008: Message edited by: Agarwal Priyanka ]
keep trying...thats the way to success...<br />with best regards...<br />p.agarwal
subject: Session query