My environment is: NetBeans7.2.1, GlassFish3.1, JSF2 and Weld 1.1.0.
I'm trying to redirect to an error page in one of these cases ( session/conversation/view timeout ).
From what I read there are number of options:
Using
<error-page>
insideweb.xml
(but for some reason when I uselocation
witherror.xhtml
page it's not working, only with a servlet - asked this question about this issue).Using
<exception-handler-factory>
insidefaces-config.xml
which will use aCustomExceptionHandler
like in this example.Using a
@WebFilter
like in this example.
My main problem is that after I'm redirecting to error.xhtml
page I want to disable going back to previous pages. so even if the user clickes on the back button he will still be redirected to the error page.
I was able to redirect to an error page when an exception accourd , but was not able to clear the cache so when the user goes back he still can see the previous page content.
I don't fully understand what are the diffrances between the 3 options above, and exactly what is the role of each option.
Can someone please explain ?
what is the diffrence between
NavigationHandler nav = fc.getApplication().getNavigationHandler();
nav.handleNavigation(fc, null, "/error");
facesContext.renderResponse();
and
((HttpServletResponse)response).sendRedirect("yourCustomJSF.jsf");
?
How can I handle these exceptions by redirecting and clearing the cache so that the user will not be able to see previous page ?
Thank's In Advance.