Link to home
Start Free TrialLog in
Avatar of phishee
phishee

asked on

need timer to countdown when a JSP session will end

Hello all,

Just was wondering if there was a way to keep a countdown timer (with JavaScript?) of a JSP session and when the session ends kick the logged-in user out of the application?  

I have a Timer script written in JavaScript that counts down from 60 minutes but I need it not to refresh as well.  I have set the web.xml of the webapp (am using Tomcat) to have the session timeout at 60 minutes also. This seems to work fine but I need the user to know the exact time they have before a sesson ends.

Thanks in advance for any and all help,
Phishee
Avatar of Mick Barry
Mick Barry
Flag of Australia image

You could keep a timer on the server but the problem is that the server has no way accessing the client when the timer ends.
Perhaps you could set your page to auto refresh every 59 minutes, and do what you have to do then.
ASKER CERTIFIED SOLUTION
Avatar of omnipath
omnipath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of buff_java
buff_java

NOTE:
   dont worry about cdId above... I initially wrote it so taht the script uses setTimeout instead of setInterval but its too much hassle.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between omnipath and buff_java

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer