4.3.2. Session Expired Handling

You can also redefine the onExpired framework method that is called on the SessionExpiration event.
Example:
A4J.AJAX.onExpired = function(loc, expiredMsg){
    if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location: "+loc)){
      return loc;
    } else {
     return false;
    }
}
This function can take the following parameters:
loc
the URL of the current page (can be updated on demand)
expiredMsg
a default message for display in the event of SessionExpiration.

Note

Customized onExpire handlers do not work under MyFaces. MyFaces handles exceptions by internally generating a debug page. To prevent this behavior, use the following:
...
<context-param>
	<param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
	<param-value>false</param-value>
</context-param> 
...