Hi! I know there is a lot of discussions and suggestions about timeout handling, but none matches my need quite.
We have a JSF project, which among other things has a certain chain of form pages. That is : user clicks a link and gets to the first form. There he fills in some data and clicks on the submit button and (if no validation error occur) gets another form page. There he enters some other data, clicks submit and so on, for about 5 pages. The problem is that if at one step he waits too long and the session expires, our code does not detect it and fails. Details: The form data on all pages is saved to a session scoped managed bean. The commandLink action is a method of that bean (different method for each page submit). Later steps use data submitted in previous steps and there it fails if the session times out and the server creates a new session and a new bean (which lacks the data from previously submitted pages). One way to solve it is to have a check in each method of the bean, but that is a lot of code. Duplicated code for that. Besides the action method there are also a lot of getter methods that are called from the JSF page that also depend on data set by previous pages. Other way is to use a filter or a phase-listener(see [1] and [2]). It seems better and simpler, but it would require some (hardcoded?) list of pages that should be checked (as opposed to other pages that do not care about session). There is also the ViewExpiredException, but apparently that does not work with STATE_SAVING_METHOD set to 'client' and that is how our project is set up. Oh, we use JSF 1.2 (Sun implementation jsf-api-1.2_04-b01-RC1.jar) and also a bit of tomahawk12-1.1.8.jar (for uploading files). I posted this question on Suns forum [3] but got answer in a different direction (client side scripts etc...) So to reiterate: What I'm looking for is a way to configure things so, that when the user clicks the form submit link, the following check will be done: if (session_is_timed_out) redirect_to_a _session_timeeout_page else process_as_normally Extending the duration of the session is not what this topic is about. (after all, that is not hard, just put a very large timeout value into web.xml) Many thanks for any help, David (Sun SWCD/SCJP, but very new to JSF) [1] http://techieexchange.blogspot.com/2008/02/jsf-session-expiry-timeout-solution.html [2] http://jsweetland.livejournal.com/3229.html [3] http://forums.sun.com/thread.jspa?threadID=5411023