public class InvokeActionEventListener extends DefaultPhaseListener implements SystemEventListener
InvokeActionEventListener will add support for new
postInvokeAction. Those events are published during the beforephase and
INVOKE_APPLICATION respectively. This actually offers a better hook on invoking actions
<f:viewParam> values been set than the
preRenderView event. In some
preRenderView event might be too late. For example, when you need to set a faces
message in the flash scope and send a redirect. Also, it won't be invoked when the validations phase has failed for
one of the
<f:viewParam> values, in contrary to the
Note that the upcoming JSF 2.2 will come with a
<f:viewAction> tag which should actually solve
the concrete functional requirement for which a
<f:event type="preRenderView"> workaround is often
been used in JSF 2.0 and 2.1.
This event is supported on any
UICommand components. This thus also provides the possibility to invoke multiple action listeners on a single
UICommand component on an easy manner.
As this phase listener has totally no impact on a webapp's default behavior, this phase listener is already
registered by OmniFaces own
faces-config.xml and thus gets auto-initialized when the OmniFaces JAR
is bundled in a webapp, so endusers do not need to register this phase listener explicitly themselves.
|Constructor and Description|
|Modifier and Type||Method and Description|
DefaultPhaseListenerto hook on
PhaseId.INVOKE_APPLICATIONand subscribes this instance as a
PostValidateEventevent. This allows collecting the components eligible for
public boolean isListenerForSource(Object source)
trueonly when the given source is an
UIComponentwhich has listeners for
public void processEvent(SystemEvent event)
UIComponentwhich passed the
isListenerForSource(Object)check has any listeners for the
PostInvokeActionEventevents and then add them to a set in the current faces context.
public void beforePhase(PhaseEvent event)
PreInvokeActionEventevent on the components which are been collected in
Copyright © 2012–2022 OmniFaces. All rights reserved.