org.omnifaces.taghandler
Class EnableRestorableView
java.lang.Object
javax.faces.view.facelets.TagHandler
org.omnifaces.taghandler.EnableRestorableView
- All Implemented Interfaces:
- javax.faces.view.facelets.FaceletHandler
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>
- Since:
- 1.3
- Author:
- Bauke Scholtz
- See Also:
RestorableViewHandler
Fields inherited from class javax.faces.view.facelets.TagHandler |
nextHandler, tag, tagId |
Constructor Summary |
EnableRestorableView(javax.faces.view.facelets.TagConfig config)
The tag constructor. |
Method Summary |
void |
apply(javax.faces.view.facelets.FaceletContext context,
javax.faces.component.UIComponent parent)
Enable the current view to be restorable. |
Methods inherited from class javax.faces.view.facelets.TagHandler |
getAttribute, getRequiredAttribute, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
EnableRestorableView
public EnableRestorableView(javax.faces.view.facelets.TagConfig config)
- The tag constructor.
- Parameters:
config
- The tag config.
apply
public void apply(javax.faces.view.facelets.FaceletContext context,
javax.faces.component.UIComponent parent)
throws java.io.IOException
- Enable the current view to be restorable. This basically sets a specific view attribute which the
RestorableViewHandler
could intercept on.
- Throws:
java.lang.IllegalArgumentException
- When given parent is not an instance of UIViewRoot
.
java.io.IOException