Name

<f:actionListener>

Synopsis

This action creates an instance of the class defined by the type attribute, which must implement the javax.faces.event.ActionListener interface, and adds it to the component represented by the closest JSF component parent action element.

For an alternative, see the action and actionListener attributes for the HTML library <h:commandButton> and <h:commandLink> actions.

Syntax

<f:actionListener type="className" />

Attributes

Attribute name

Java type

EL expression type

Description

type
String

Any

The fully qualified class name for a class implementing the ActionListener interface.

Example

<h:form>
  <h:commandButton value="Save">
    <f:actionListener type="com.mycompany.SaveListener" />
  </h:commandButton>
</h:form>

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.