Can anybody please let me know how can I achieve the below task
I want that if the user is idle for say 5 minutes it should be redirected to Log in page
I tried the following things but unable to achieve the result
1. I configured web.xml and added
I am able to make the session expire after 5 mins
But how can I make it automatically redirected to Login page.
parvez Moinuddin wrote:But how can I make it automatically redirected to Login page.
You'll have to explain what you mean by this.
If you mean that, all by itself, the page should redirect when the session expires, well that's impossible. Without making any request back to the server, how would the browser know that the session has expired? Think about that.
request.isRequestedSessionIdValid() will give you boolean return if session is valid. As Bear Bibeault has already explained this can not happen automatically and you have to set JS timer for that nut using this atleast you can take care that if user is on the same page till timeout happens and try making new request it will redirect user to your session expire page for this you have to place your code inside the if block having this check condition.