It's not a secret anymore!
The moose likes Servlets and the fly likes Session query Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 3028
    
    4

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
    
  13

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
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Session query
 
Similar Threads
[Help] Null Pointer Exception in session.flush() Hibernate
Accessing implicit Objects in JSP
Doubt on session() and session(false)
New session id in Jboss
getting session null instead of creating new session.