You can do this strictly client-side, if requiring Javascript isn't a problem (which of course an AJAX-based solution does anyway). Just start a timer from the onLoad event on each page. When 20 minutes has elapsed, you can either pop an alert which is followed by a redirect to some appropriate page, or just do the redirect straight away, whatever you prefer.

The down-side is that a user could disable Javascript after the timer has begun but before the timeout occurs. But, of course the session will still expire on the server, so it's probably not a big problem. And you'll need to keep your session timeout and client-side timeout values in sync, but that's pretty minor.

Frank

Jon Wingfield wrote:
I did an AJAX version of this a couple of months ago.
The slight gotcha is that the AJAX request prolongs the life of the session (you can't, it seems, override the cookie for AJAX requests) so the interval has to be slightly longer than the expiry time for the session.

Reynir Hubner wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I would suggest that you do this by using somethinglike JSON or AJAX.
See jasonspec: http://www.crockford.com/JSON/index.html

You could make the client query your server, in some interval and check
the session state.

hope it helps
- -reynir



Mark wrote:

Is there any way to allow servlets to auto-logout a user when the timeout
has been reached. Right now, I have tomcat configured for a 20 minute
session timeout. When the session times out, the user gets no notification of this event. Is there any way to show the user that they have logged out?

Thank you.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDeeqn19KgIQihNwgRAqT8AJ9ijf9kZZlldgjRTcAEtua+89enKQCgnqjm
iuCZACbq4A/JkmtB5yiIc8M=
=HSCq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to