2 Replies Latest reply on Feb 5, 2010 10:08 AM by agallo73

    problems when session times out

    agallo73

      Hello. I'd like to display a customized page that shows a message when the session times out.

       

       

      I'd like to know which is the better approach to do this thing.

       

       

       

      I saw several posts concerning this problem.

       

      One suggests to use

       

      <context-param>

       

          <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>

       

          <param-value>true</param-value>

       

      </context-param>

       

       

       

      <script type="text/javascript">  A4J.AJAX.onError = function(req,status,message){ window.alert("Custom onError handler "+message); }

       

      A4J.AJAX.onExpired = function(loc,expiredMsg){ if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location:
      "+loc)){ return loc; } else { return false; } }
      </script>

       

       

      but when I do so I do not see anything and only get  an exception in the log files:

       

      ERROR [lifecycle] JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@10bc0c7]

       

       

      I put the script definition in my main xhtmll file used through all the wizard.

       

       

      An other approach seems to use a phase listener and control when the session gets null (times out)  forwarding the user to an ad hoc aspage when this happens.

       

      What do you suggest?

       

      Is there a good solution to use?