JBoss.orgCommunity Documentation
The
"type"
attribute defines the fully qualified Java class name for the listener.
This Java class should implement
org.ajax4jsf.event.AjaxListener
interface which is base interface for all listeners, capable for receiving Ajax events.
The object on which the Event initially occurred could be accessed using the
java.util.EventObject.getSource()
method.
The <a4j:ajaxListener> is not invoked for non-Ajax requests and when RichFaces works in the "Ajax Request generates Non-Ajax Response" mode, so <a4j:ajaxListener> invocation is a good indicator that Ajax Response is going to be processed. Let's check it in the following example.
Example:
...
<rich:messages/>
<h:form id="form">
<a4j:commandLink value="Click to send Ajax request">
<a4j:ajaxListener type="org.docs.richfaces.actionListenerBean"/>
</a4j:commandLink>
</h:form>
...
Example:
...
public class ActionListenerBean implements org.ajax4jsf.event.AjaxListener {
public void processAjax(AjaxEvent event) {
FacesContext.getCurrentInstance().addMessage("form", new FacesMessage("Ajax request is sent"));
}
}
...
There is a result:
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.