Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session query

 
Philip Zac
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Agarwal Priyanka
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic