elmakarge
asked on
When sessions is timeout , a new javascript window appears on screen?
Hi dear experts,
I am using tomcat 5.0.x and developing web application with jsp. When my client session is time out , I want to show popup window saying that "your session is dead because you didnt do anything for 15 minutes".
How can i do this ? to know when session it time out i have to write a listener but how can i popup a windows through servlet or jsp when session is time out?
I am using tomcat 5.0.x and developing web application with jsp. When my client session is time out , I want to show popup window saying that "your session is dead because you didnt do anything for 15 minutes".
How can i do this ? to know when session it time out i have to write a listener but how can i popup a windows through servlet or jsp when session is time out?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use session.getMaxInactiveInte rval() API call to set timeout value dynamically in your HTML output
ASKER
Why do i have to change all jsp files Cant i pass session timeout value from web.xml to javascript by a variable ? I know that we reach paramter values in web.xml from jsp files?
Am i wrong ?
Am i wrong ?
> Cant i pass session timeout value from web.xml to javascript by a variable ?
ramazanyich just showed you how :-)
<body onLoad="setTimeout( function, <%= session.getMaxInactiveInte rval() %> * 60 * 1000 )">
ramazanyich just showed you how :-)
<body onLoad="setTimeout( function, <%= session.getMaxInactiveInte
NOTE: getMaxInactiveInterval() returns timeout in seconds. So you should remove *60. Modified string will look like:
<body onLoad="setTimeout( function, <%= session.getMaxInactiveInte rval() %> * 1000 )">
<body onLoad="setTimeout( function, <%= session.getMaxInactiveInte
Of course, if you change your timeout in web.xml, you will need to change all of your jsp's too ;-)