The actionListener Attribute
The Rushmore application uses a button with an image, action,
and actionListener attribute:
<h:commandButton image="mountrushmore.jpg"
actionListener="#{rushmore.handleMouseClick}"
action="#{rushmore.navigate}" ... />
The handleMouseClick method:
- Since it is a listener, it is passed the action event containing click
information.
- It cannot affect navigation, so it stores an outcome string in an
instance field.
The navigate method:
- Is called after the listener method.
- Simply returns the stored outcome string.