Component identification parameters

Name | Value
--- | ---
listener-class | org.ajax4jsf.framework.ajax.AjaxListener
event-class | org.ajax4jsf.framework.ajax.AjaxEvent
tag-class | org.ajax4jsf.taglib.html.jsp.AjaxListenerTag

## Creating on a page

Simple Component definition on a page:

Example:

    ...
    	<a4j:ajaxListener type="demo.Bean"/>
    ...

## Dynamical creation of a component from Java code

Example:

    package demo;

    public class ImplBean implements import org.ajax4jsf.component.html.AjaxListener{
    	...
    }

    import demo.ImplBean;
    ...
    ImplBean myListener = new ImplBean();
    ...

## Key attributes and ways of usage

Additional to the listeners provided by JSF specification, RichFaces add one more: Ajax Listener ( <a4j:ajaxListener> ). Ajax Listener is invoked before the Render Response phase. Instead of Action Listener of Value Change Listener which are not invoked when Validation of Update Model phases failed, Ajax Listener is guarantied to be invoked for each Ajax response. Thus, it is a good place for update the list of re-rendered components, for example. Ajax Listener is not invoked for non-Ajax request and when RichFaces works in "Ajax Request generates Non-Ajax Response" mode. Therefore, Ajax Listener invocation is a good indicator that Ajax response is going to be processed. Attribute "type" defines the fully qualified Java class name for listener. This class should implement org.ajax4jsf.framework.ajax.AjaxListener interface. You can access to the source of the event (Ajax component) using event.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.framework.ajax.AjaxEvent;

    public class Bean implements org.ajax4jsf.framework.ajax.AjaxListener{
    ...
    	public void processAjax(AjaxEvent arg0){
    		//Custom Developer Code
    	}
    ...
    }

## Relevant resources links

Some additional information about usage of component can be found here.