Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session problem  RSS feed

 
archana vishwanath
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Im using session to track userid in my JSP pages.Initially im able to retrive the values stored in seesion in all my pages without any problem.
What happens after a period of inactivity is im not able to retrive those values and because of this my page is throwing errors.
Now I need a method to find out weather my session has expired or not
and if expired,I need to process accordingly.Somebody pls help me with this.
Thanks in Advance.
 
fethi makhlouf
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
did you tried session.invalidate() ?
else try it!
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually sessions expire after a certain amount of time.Even you can set that time.So when your session got expired that session variable will be null.
So in your jsp page you can just check whether the session u want is null or not.If it is null then do whatever you want.
Something like this,
if(session.getAttribute("name")==null){ blah blah..}
Jyothsna
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Archana,
You should try session.isNew(). Hv a look at this method.
[ April 19, 2004: Message edited by: Kaustubh Patil ]
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya, i am sorry.i understood in the otherway.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!