Top Description Methods
jakarta.faces.component

public Interface ActionSource

Known Direct Subinterfaces
jakarta.faces.component.ActionSource2
Known Direct Implementers
jakarta.faces.component.UICommand, jakarta.faces.component.UIViewAction
Imports
jakarta.el.MethodExpression, jakarta.faces.event.ActionEvent, .ActionListener

ActionSource is an interface that may be implemented by any concrete UIComponent that wishes to be a source of ActionEvents, including the ability to invoke application actions via the default ActionListener mechanism.

Method Summary

Modifier and TypeMethod and Description
public void
addActionListener(ActionListener
The ActionListener to be added
listener
)

Add a new ActionListener to the set of listeners interested in being notified when ActionEvents occur.

public default MethodExpression

Returns:

the action expression.
getActionExpression
()

Return the MethodExpression pointing at the application action to be invoked, if this UIComponent is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property.

public ActionListener[]

Returns:

the action listeners, or a zero-length array.
getActionListeners
()

Return the set of registered ActionListeners for this ActionSource instance.

public boolean

Returns:

true if immediate, false otherwise.
isImmediate
()

Return a flag indicating that the default ActionListener provided by the Jakarta Faces implementation should be executed immediately (that is, during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase.

public void
removeActionListener(ActionListener
The ActionListener to be removed
listener
)

Remove an existing ActionListener (if any) from the set of listeners interested in being notified when ActionEvents occur.

public default void
setActionExpression(MethodExpression
The new method expression
action
)

Set the MethodExpression pointing at the appication action to be invoked, if this UIComponent is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property.

public void
setImmediate(boolean
The new immediate execution flag
immediate
)

Set the "immediate execution" flag for this UIComponent.

Method Detail

addActionListenerback to summary
public void addActionListener(ActionListener listener)

Add a new ActionListener to the set of listeners interested in being notified when ActionEvents occur.

Parameters
listener:ActionListener

The ActionListener to be added

Exceptions
NullPointerException:
if listener is null
getActionExpressionback to summary
public default MethodExpression getActionExpression()

Return the MethodExpression pointing at the application action to be invoked, if this UIComponent is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property.

The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend ActionSource. Historically this method was declared in ActionSource2 for precisely this reason but default methods in interfaces weren't supported.

Returns:MethodExpression

the action expression.

Since
4.1
getActionListenersback to summary
public ActionListener[] getActionListeners()

Return the set of registered ActionListeners for this ActionSource instance. If there are no registered listeners, a zero-length array is returned.

Returns:ActionListener[]

the action listeners, or a zero-length array.

isImmediateback to summary
public boolean isImmediate()

Return a flag indicating that the default ActionListener provided by the Jakarta Faces implementation should be executed immediately (that is, during Apply Request Values phase of the request processing lifecycle), rather than waiting until the Invoke Application phase. The default value for this property must be false.

Returns:boolean

true if immediate, false otherwise.

removeActionListenerback to summary
public void removeActionListener(ActionListener listener)

Remove an existing ActionListener (if any) from the set of listeners interested in being notified when ActionEvents occur.

Parameters
listener:ActionListener

The ActionListener to be removed

Exceptions
NullPointerException:
if listener is null
setActionExpressionback to summary
public default void setActionExpression(MethodExpression action)

Set the MethodExpression pointing at the appication action to be invoked, if this UIComponent is activated by the user, during the Apply Request Values or Invoke Application phase of the request processing lifecycle, depending on the value of the immediate property.

Any method referenced by such an expression must be public, with a return type of String, and accept no parameters.

The default implementation throws UnsupportedOperationException and is provided for the sole purpose of not breaking existing applications that extend ActionSource. Historically this method was declared in ActionSource2 for precisely this reason but default methods in interfaces weren't supported.

Parameters
action:MethodExpression

The new method expression

Since
4.1
setImmediateback to summary
public void setImmediate(boolean immediate)

Set the "immediate execution" flag for this UIComponent.

Parameters
immediate:boolean

The new immediate execution flag