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)

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.


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

Write Answer

©2024 | Privacy Policy | Contact Us