File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to notice the user about session expire before (n) min 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 » JSP
Bookmark "How to notice the user about session expire before (n) min" Watch "How to notice the user about session expire before (n) min" New topic
Author

How to notice the user about session expire before (n) min

Saravanan Ramamoorthy
Greenhorn

Joined: Feb 01, 2010
Posts: 1
Hi All,

How to notice the user about session expire before (n) min by providing popup alerts. If the user want to renew the session, need an option to provide the same.
Please provide your suggestions or reference.

Regards
Saravanan Ramamoorthy
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Since the server can not send anything to the client without a request, and a request would reset the session timer, your best bet is a countdown clock in Javascript running on the browser.

Bill
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
William Brogden wrote:Since the server can not send anything to the client without a request, and a request would reset the session timer, your best bet is a countdown clock in Javascript running on the browser.

Bill


This will not be accurate if your app is open in multiple browser-tabs. This question is pain in a$$. See two different approaches I tried.

http://www.coderanch.com/t/498067/JSP/java/catch-session-timeout-event

http://www.coderanch.com/t/498677/JSP/java/response-senRedirect-does-not-seem
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to notice the user about session expire before (n) min
 
Similar Threads
Server Session Timeout
Session Time out Issue
regarding session
session time out in application after specific time
Session time-out notification