public class ViewAction extends UIViewAction
The <o:viewAction> is a component that extends the standard <f:viewAction> and
changes the if attribute to be evaluated during INVOKE_APPLICATION phase instead of the
APPLY_REQUEST_VALUES phase. This allows developers to let the if attribute check the
converted and validated model values before performing the view action, which results in much more intuitive behavior.
In below example, the FooConverter may convert a non-null parameter to null without causing
a validation or conversion error, and the intent is to redirect the current page to otherpage.xhtml when
the converted result is null.
<f:viewParam name="foo" value="#{bean.foo}" converter="fooConverter" />
<f:viewAction action="otherpage" if="#{bean.foo eq null}" />
This is however not possible with standard <f:viewAction> as it evaluates the if
attribute already before the conversion has taken place. This component solves that by postponing the evaluation of
the if attribute to the INVOKE_APPLICATION phase.
<f:viewParam name="foo" value="#{bean.foo}" converter="fooConverter" />
<o:viewAction action="otherpage" if="#{bean.foo eq null}" />
Only when you set immediate="true", then it will behave the same as the standard
<f:viewAction>.
You can use it the same way as <f:viewAction>, you only need to change f: to
o:.
<o:viewAction action="otherpage" if="#{bean.property eq null}" />
| Modifier and Type | Field and Description |
|---|---|
static String |
COMPONENT_TYPE |
COMPONENT_FAMILYATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY| Constructor and Description |
|---|
ViewAction() |
| Modifier and Type | Method and Description |
|---|---|
void |
broadcast(FacesEvent event)
Only broadcast the action event when
UIViewAction.isRendered() returns true. |
boolean |
isRendered()
Returns
true if the immediate="true" attribute is not set, otherwise
delegate to super, hereby maintaining the original behavior of immediate="true". |
addActionListener, decode, getAction, getActionExpression, getActionListener, getActionListeners, getFamily, getPhase, isImmediate, isOnPostback, isProcessingBroadcast, removeActionListener, setAction, setActionExpression, setActionListener, setImmediate, setOnPostback, setPhase, setRenderedaddClientBehavior, addFacesListener, clearInitialState, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEventencodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTreepublic static final String COMPONENT_TYPE
public void broadcast(FacesEvent event) throws AbortProcessingException
UIViewAction.isRendered() returns true. The default
implementation will always broadcast. The UIViewAction.isRendered() is by default only considered during
UIViewAction.decode(javax.faces.context.FacesContext).broadcast in class UIViewActionAbortProcessingExceptionpublic boolean isRendered()
true if the immediate="true" attribute is not set, otherwise
delegate to super, hereby maintaining the original behavior of immediate="true".isRendered in class UIViewActionCopyright © 2012–2016 OmniFaces. All rights reserved.