views:

76

answers:

3

I am using JSF and have javax.faces.STATE_SAVING_METHOD to client in web.xml. What I want to happen is, when session times out and I try to redirect to another page, it must redirect to sessionTimeout.jsf and on click of a button on that page, it must redirect to login.jsf. I have designed sessionTimeout.jsf. Whenever session expires and I try to navigate to a different page, javax.faces.application.ViewExpiredException is thrown. I have set a session variable in target page so that everytime it goes to that page, it first checks the variable but here its throwing exception before going to that page. How to solve this ?

+1  A: 

This could help

Regards

StudiousJoseph
I cannot put <error-page> tag in faces-config.xml and putting it in web.xml wont make any difference
Prabhat
What JSF implementation are you using, MyFaces, Facelets, Richfaces, etc?
StudiousJoseph
I am using Richfaces
Prabhat
@Prabhat: http://stackoverflow.com/questions/3206922/issue-with-jsf-viewexpiredexception-and-multiple-error-page-tag-definitions-in-we
BalusC
A: 

The solution is to add:

<a4j:region>
 <script language="javascript">
 A4J.AJAX.onExpired = function(loc, expiredMsg){
  window.location = "/sessionTimeOut.jsf";
 }
 </script>
</a4j:region>

Read more in RichFaces guide

Odelya
A: 

add to Web.xml give message in page for reloading...

enter code here 
<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>viewExpired.xhtml</location>
</error-page>
taher
Read the other answers and the comments on other answers before unnecessarily posting a duplicate answer.
BalusC