This is configured in web.xml as-
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/ch9/ch9_5/expired.xhtml</location>
</error-page>
And the structure in Eclipse is-
index.xhtml page-
<h:body>
Please, force view expiration!
<h:form>
<h:commandButton value="Logout!" action="#{logoutBean.logoutAction()}"/>
</h:form>
</h:body>
LogoutBean.java-
@ManagedBean
@javax.faces.bean.RequestScoped
public class LogoutBean {
public String logoutAction() throws IOException {
ExternalContext externalContext =
FacesContext.getCurrentInstance().getExternalContext();
externalContext.invalidateSession();
return "byebye.xhtml?faces-redirect=true;";
}
}
byebye.xhtml-
<h:body>
Bye, Bye session! You are logout! Press browser back button ...
</h:body>
expired.xhtml-
<h:body>
Your session expired ...
<h:link value="Go to Login Page ..." outcome="index.xhtml" />
</h:body>
This is shown in Google Chrome when the view is expired.
1) The first problem with this is that only the hardcoded text appears, and not the link,
Your session expired ...(link absent for index.xhtml)
2) How to reflect the error page url in the browser window?
3) Thirdly, in IE 11.0.9600, the error-page doesn't appear at all. What might be the reason for this? How to be consistent for both these browsers?