permaculture playing cards*
The moose likes JSP and the fly likes how to monitor how long the session is on 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 » JSP
Bookmark "how to monitor how long the session is on" Watch "how to monitor how long the session is on" New topic
Author

how to monitor how long the session is on

sarasah guna
Greenhorn

Joined: Dec 12, 2005
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61103
    
  66

I do not understand what you are asking.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I don't quite understand either,
but do you mean HttpSession.getCreationTime() ?


[My Blog]
All roads lead to JavaRanch
sarasah guna
Greenhorn

Joined: Dec 12, 2005
Posts: 10
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

Joined: Jan 10, 2002
Posts: 61103
    
  66

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

Joined: Mar 22, 2000
Posts: 12769
    
    5
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
 
Consider Paul's rocket mass heater.
 
subject: how to monitor how long the session is on