tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: advice on auto logout servlet
Date Wed, 16 Nov 2005 16:38:18 GMT
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.


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:
>> Hash: SHA1
>> Hi,
>> I would suggest that you do this by using somethinglike JSON or AJAX.
>> See jasonspec:
>> 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.
>> Version: GnuPG v1.2.5 (MingW32)
>> Comment: Using GnuPG with Thunderbird -
>> iD8DBQFDeeqn19KgIQihNwgRAqT8AJ9ijf9kZZlldgjRTcAEtua+89enKQCgnqjm
>> iuCZACbq4A/JkmtB5yiIc8M=
>> =HSCq
>> -----END PGP SIGNATURE-----
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
AIM: fzammetti
Yahoo: fzammetti

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message