*
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 Android Security Essentials Live Lessons this week in the Android 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: 60810
    
  65

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: 60810
    
  65

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: 12761
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to monitor how long the session is on
 
Similar Threads
Confused about getSession
How many session object created in a single jsp page?
Session get value of 0 is not displaying
A diffrent problem on request attributes
Logout and Tomcat Manager application session tracking