It looks like this should work now...
You could include this in a header.jsp file and use the <jsp:include>
directive (appropriately placed in the page) to render the following output
to every view on the client.
<%
int sessionTimeout;
//Calculate sessionTimeout in seconds via the methods outlined in the
session object.
//sessionTimeout=...
//Add however many minutes you want as a warning in terms of seconds:
int minutesWarning = 60;
sessionTimeout += minutesWarning
//express sessionTimeout in terms of milliseconds
sessionTimeout *= 1000;
%>
<script language="javascript">
function confirmLogoff() {
if (confirm("Your session will end in one minute.\n\nPress OK to
continue for another ten minutes.")){
location.reload();
}
}
setTimeout("confirmLogoff()", <%= sessionTimeout %>);
</script>
The key here is that the client is 'dumb' about sessions so you have to
invoke your own method of utilizing the warning, be it a running javascript
clock or some other method to make the page interact with the user regarding
their session. Try something creative. My solution above is just one of
MANY possible solutions.
-----Original Message-----
From: John Zhao [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 9:40 AM
To: JRun-Talk
Subject: RE: Is it possible to see session timeout in the servlet?
Can you use the session.getLastAccessedTime, session.getMaxInactiveInterval,
and System.currentTimeMillis to calculate the remaining session time?
-----Original Message-----
From: Anne-Li Mell [mailto:[EMAIL PROTECTED]
Sent: Monday, November 22, 2004 9:47 AM
To: JRun-Talk
Subject: SV: Is it possible to see session timeout in the servlet?
Thank you so much for your help, Jeffrey! What you wrote sounds good, but
I'm afraid that I still don't quite understand. You wrote:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:8:5607
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/8
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:8
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.8
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54