1 Reply Latest reply on Oct 7, 2010 10:15 AM by lvdberg

    Conditional redirect - ViewExpiredException

    sykwitit

      I have the same problem as stated in this topic. Because i didn't find the solution there I have posted the question once more.
      The requirement is to handle ViewExpiredException based on the url context. Ex: When the application View Expires while accessing the pages


      1. http://localhost/applicationname should redirect the ViewExpriedException to say


      <redirect view-id="/login.xhtml>





      2. http://localhost/adminconsole should redirect the ViewExpriedException to say




      <redirect view-id="/admin-login.xhtml">




      I am not sure how I can configure this in pages.xml. Please help.

        • 1. Re: Conditional redirect - ViewExpiredException
          lvdberg

          Hi,


          The basic definition is:


          <exception class="javax.faces.application.ViewExpiredException" log="false">
                 <redirect  view-id="##### see next #####">
                     <message severity="WARN">#{messages['view_expired']}</message>
                 </redirect>
              </exception>
          
          



          As stated in the mentioned thread: using


          #{facesContext.externalContext.requestServletPath}#{facesContext.externalContext.requestPathInfo}
          



          Will redirect after the exception to the page where the error occured


          The view-id contains EL, so you could enter some conditional logic like:



          1. {condition ? step 1 : step 2}



          Meaning you can still read bean content and use it as input for your view-id logic.


          Leo