The Java EE 5 Tutorial

Referencing a Method That Handles an Action Event

If a component on your page generates an action event, and if that event is handled by a backing bean method, you refer to the method by using the component’s actionListener attribute.

The chooselocale.jsp page of the Duke’s Bookstore application includes some components that generate action events. One of them is the NAmerica component:

<h:commandLink id="NAmerica" action="bookstore"
     actionListener="#{localeBean.chooseLocaleFromLink}">

The actionListener attribute of this component tag references the chooseLocaleFromLink method using a method expression. The chooseLocaleFromLink method handles the event of a user clicking on the hyperlink rendered by this component.

Writing a Method to Handle an Action Event describes how to implement a method that handles an action event.