File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Session query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session query" Watch "Session query" New topic
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: 4181
    
  21

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: 61104
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Agarwal Priyanka
Greenhorn

Joined: Jul 25, 2008
Posts: 20
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Session query