define error pages location jsf 2

Go To StackoverFlow.com

0

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

2012-04-04 19:37
by Kelly Goedert


1

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.

2012-04-04 21:05
by BalusC
I tried that... did not work. I even tried to put /sample/login.xhtml, sample is my context. But it also did not work - Kelly Goedert 2012-04-04 21:31
Well, I don't see any other possible causes based on the information given so far - BalusC 2012-04-04 21:38
Ads