Home  >  Forum  >  JSF
Post New Query

javax.faces.application.ViewExpiredException: viewId: could not be restored



Asked on January 17, 2015
What causes below error, I am getting this error sometimes in my application.

javax.faces.application.ViewExpiredException: viewId: could not be restored.
com.sun.faces.lifecycle.RestoreViewPhase.execute(Unknown Source)
com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(Unknown Source)
com.sun.faces.lifecycle.LifecycleImpl.execute(Unknown Source)
javax.faces.webapp.FacesServlet.service(Unknown Source)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)



Replied on January 17, 2015
By default, JSF saves the state of view in servlet session. If our JSF view page is inactive from long time and if trying to access view state from session, it may possible that session is expired. Then exception will be thrown javax.faces.application.ViewExpiredException.

To avoid this exception, we should save view state in client side by setting below configuration.

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>

Setting this, view state will be saved in hidden field in client side.



Write Answer








©2019 concretepage.com | Privacy Policy | Contact Us