JSF States affecting session timeout
843844Jan 4 2010 — edited Jan 4 2010Hi,
I have a JSF1.2 ; application running on Tomcat 6.
The application designed in such a way that only one person at a time can make changes. So the first user login the application can save any changes. In the mean time if any other user login the application, that user can only see the application and cant save any changes.
The session timeout is set to 15 min in web.xml. My issue is that if first user login the application and close the browser window using X. That session is not cleared in server after 15 min. That is any other user who login the application cannot able to save or edit even after the session timeout . After some 2 days, we able to login and do the save's.
So i investigated this issue and tried to write some script and capture the Browser Close event using onBeforeUnload method. This does not work in my application since the onBeforeUnload method is called for refresh and for navigation.
In JSF i found that my application saving the states in server side.
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD;/param-name>
<param-value>server</param-value>
</context-param>
I tested my application by saving the states in client side.
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD;/param-name>
<param-value>client</param-value>
</context-param>
This seems to work and the session was cleared after 15 min. But the application are in such a stage that we can afford to change the state since All of our testing was done with it set to server. All of our development was done with the assumption that it was set to server.
So can anyone provide a solution for my issue?
Without changing the server state whether can we clear the user session when session timeout?
Thanks in advance.