public class EnableRestorableView
extends javax.faces.view.facelets.TagHandler
The <o:enableRestorableView>
instructs the view handler to recreate the entire view whenever the
view has been expired, i.e. whenever ViewHandler.restoreView(FacesContext, String)
returns null
and the current request is a postback. This effectively prevents ViewExpiredException
on the view. This tag
needs to be placed in <f:metadata>
of the view.
There are however technical design limitations: the recreated view is exactly the same as during the initial request, so any modifications which are made thereafter, either by taghandlers or conditionally rendered components based on some view or even session scoped variables, are completely lost. In order to recreate exactly the desired view, you would need to make sure that those modifications are made based on request scoped variables (read: request parameters) instead of view or session scoped variables. In other words, the state of the restorable view should not depend on view or session scoped managed beans, but purely on request scoped managed beans.
To enable the restorable view, just add the <enableRestorableView>
to the view metadata.
<f:metadata> <o:enableRestorableView/> </f:metadata>
RestorableViewHandler
Constructor and Description |
---|
EnableRestorableView(javax.faces.view.facelets.TagConfig config)
The tag constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(javax.faces.view.facelets.FaceletContext context,
javax.faces.component.UIComponent parent)
Enable the current view to be restorable.
|
public EnableRestorableView(javax.faces.view.facelets.TagConfig config)
config
- The tag config.public void apply(javax.faces.view.facelets.FaceletContext context, javax.faces.component.UIComponent parent) throws IOException
RestorableViewHandler
could intercept on.IllegalArgumentException
- When given parent is not an instance of UIViewRoot
.IOException
Copyright © 2012–2014 OmniFaces. All rights reserved.