Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.1.1.  < a4j:ajaxListener > available since 3.0.0

The component adds an action listener to a parent component to provide possibility of Ajax update. It works like the <f:actionListener> or <f:valueChangeListener> JSF components but for the whole Ajax container.

The <a4j:ajaxListener> component adds an action listener to a parent component, which needs to be provided with Ajax support. That listener is invoked on each Ajax request during the "Render Response" JSF phase. In comparison with JSF <f:actionListener> and <f:valueChangeListener> the invocation of the <a4j:ajaxListener> is not skipped in case when validation of Update Model fails. The <a4j:ajaxListener> is guarantied to be invoked for each Ajax response.

As example of the <a4j:ajaxListener> component usage one can cite an updating the list of re-rendered components.

The "type" attribute defines the fully qualified Java class name for the listener. This Java class implements org.ajax4jsf.event.AjaxListener interface, which is base interface for all listeners, capable for receiving Ajax events. The source of the event could be accessed using the java.util.EventObject.getSource() call.

Example:


...
<a4j:commandLink id="cLink" value="Click it To Send Ajax Request">
      <a4j:ajaxListener type="demo.Bean"/>
</a4j:commandLink>
...

Example:

package demo;


import org.ajax4jsf.event.AjaxEvent;
public class Bean implements org.ajax4jsf.event.AjaxListener{
     ...    
     public void processAjax(AjaxEvent arg){
          //Custom Developer Code 
     }
     ...
}

Table of <a4j:ajaxListener> attributes.


Visit AjaxListener page at RichFaces Livedemo for examples of component usage and their sources.

Check Sun JSF TLD documentation for more information on <f:valueChangeListener> tag.