This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes session timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "session timeout" Watch "session timeout" New topic
Author

session timeout

shailesh kumar
Ranch Hand

Joined: Jul 18, 2005
Posts: 36
In my application I have this session timeout javascript function and works well. I have to give timeout message to the user after 20 mins of inactivity. We have some applets also. But the timeout function gives the alert message even if the user is working on the applet. I understand that Browser and applet are two diffrent things, i guess thats why its not working properly. Is there a good way to implement this functionality in applets ?, please advice.

Function:

function ShowTimeoutWarning()
{
window.alert( "Your session has been timed out. As a security precaution, sessions are invalidated after 20 minutes of inactivity. You can log in again to resume.!" );
window.location.href="Login.jsp";
}

setTimeout( 'ShowTimeoutWarning();', 60000 );
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41017
    
  43
You could keep track of the time each time the user does something in the GUI; the event handlers would be a good place for this. If at some point the time since the last event is more than 20 minutes you can require a re-login.

But it sounds like you only want to time out if the user accesses neither the web page nor the applet - correct? For that you'd need to implement some kind of Java<-->JavaScript interaction; some hints on how to do that can be found here.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session timeout
 
Similar Threads
session timeout
Session Timeouts - Websphere
Session
Session Timeout Timer Reset
Application Times Out