my dog learned polymorphism
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
Register / Login


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

I do not understand what you are asking.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

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: 56179
    
  13

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: 12267
    
    1
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


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: how to monitor how long the session is on
 
Similar Threads
Confused about getSession
Logout and Tomcat Manager application session tracking
A diffrent problem on request attributes
Session get value of 0 is not displaying
How many session object created in a single jsp page?