Documentation
JSFToolbox

Search 

Contents

  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
Selected 12. JSF Tag Reference

12. JSF Tag Reference

Contents > JSF Tag Reference > JSF Core Tags > f:actionListener

f:actionListener

The ActionListener tag registers an ActionListener with the component associated with the enclosing tag. An ActionListener is an event handler interface for a class that can respond to user events in your JSF page. The body content of this tag must be empty.

Example:

<form id="form1">
  <h:commandButton id="button1" value="Click">
    <f:actionListener type="com.mycompany.ActionListenerImpl" />
  </h:commandButton>
</form>

HTML Output

<form id="form1" name="form1"
  method="post" action="somepage.jsp"
  enctype="application/x-www-form-urlencoded">
  <input id="form1:button1" name="form1:button1" type="submit"
    onclick="clear_form1();"/>
  <input type="hidden" name="form1_SUBMIT" value="1"/>
  <input type="hidden" name="form1:_link_hidden_"/>
  <script type="text/javascript">
  <!--  generated javascript -->
  </script>
</form>

(This code will invoke a method called processAction on the class com.mycompany.ActionListenerImpl when the form button is pressed.)

Tag Attributes

type String
Required
The fully qualified Java class name of an ActionListener to be created and registered with the parent component.