I am trying to resolve an apparently simple issue but so far no success.
I am developing a web application in JSF 2.2 with PrimeFaces 5.3 and tomcat 8 . I am trying to deal with ViewExpiredException, so that I can redirect the user to index or login page whenever session timeout occurs. I tried adding error-page tag in web.xml to catch the exception and redirect on login page, but no success.
I followed this link (along with several others) to seek guidance but as I mentioned earlier, it did not work for me.
Any help will be highly appreciated.
Below is my application's web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>ricpacs</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{themeSwitcherView.selectedTheme}</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<session-config>
<!-- Session idle timeout in min. -->
<session-timeout>1</session-timeout>
</session-config>
<error-page>
<exception-type>
javax.faces.application.ViewExpiredException
</exception-type>
<location>/index.jsp</location>
</error-page>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
I have tried both values (Development and Production) for PROJECT_STAGE. But that did not help either.