Is there a database-, primefaces- and "keep-session-alive"-free solution to prevent or to handle a ViewExpiredException silently in the background while restoring the form-inputs?
for example a user with a "stay logged-in cookie" would prefer not to be redirected to some kind of an error- or start-page; he fills out some form values, comes back in an hour and then, when he submits the form, the same view is re-created with its previous inputs and the submit-action of the underlying requestscope-bean is re-executed again.
i already took notice of omnifaces and mojarras
<o:enableRestorableView />
<f:view transient="true">
but as we talk about permanent logged-in users, i am not shure, if this would be the right approach.
thanks for pointing into the right direction.
the same view is re-created with its previous inputs and the submit-action of the underlying requestscope-bean is re-executed again
For exactly this requirement, transparently recreating and restoring an expired JSF form tied to a request scoped bean, stateless JSF as in <f:view transient="true">
is the correct solution.
The <o:enableRestorableView>
is unnecessary in this specific case. It is only useful for transparently recreating and restoring an expired JSF form tied to a view scoped bean. You only still have to manually populate the view scoped bean properties based on request parameters in its @PostConstruct
.
In other words, you don't need to mix those solutions. It does technically not make sense as view scoped beans are useless anyway in stateless JSF, they will behave like request scoped beans.