Reputation: 1067
I am trying to redirect my user to the login page when the session expires. I followed the instructions on this link How to handle session expiration and ViewExpiredException in JSF 2? and it works, except for the fact that it redirects me to a non existing page.
In my application root, I have a login.xhtml page. So in my web.xml I have this:
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/login.xhtml</location>
</error-page>
But while using the application I am at localhost/sample/user/create.sm when the session expires, it redirects me to localhost/sample/user/login.xhtml, while I expected to be redirected to localhost/sample/login.sm. How should I make the correct configuration?
I am using jboss 6.1 and mojarra 2.1.7
Thanks
Upvotes: 0
Views: 546
Reputation: 1108577
The <location>
has to match the FacesServlet
mapping. You seem to have mapped it on *.sm
instead of *.xhtml
. In that case, change /login.xhtml
to /login.sm
.
Upvotes: 1