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

how to monitor how long the session is on

 
sarasah guna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey ,
My promblem is that that session does not exprie becouse the the sesion is created when the page created .How do I monitor the session time as long the page is aceess.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not understand what you are asking.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't quite understand either,
but do you mean HttpSession.getCreationTime() ?
 
sarasah guna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have jsp page where i have set the interval equal 1800 milisecond ..How to make keep trak of the interval time .Becouse my current page only find create time when the page is load .How to I make sure the session time is check when the user fill up the form.thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not be tryng to use the session as a timer. There's Javascript mechanisms for that.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The way to store a system timestamp in a session is to create a Long object like this:
Long tstamp = new Long( System.currentTimeMillis() );
and store it in the session:
session.setAttribute("lastaction", tstamp);
(you have to use a Long because sessions only store object references)
On subsequent requests you can recover the timestamp value and compute the number of milliseconds in the interval.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic