Chapter 5. Actions
- 5.1.
<a4j:ajax> - 5.2.
<a4j:param> - 5.3.
<a4j:actionListener> - 5.4.
<a4j:commandButton> - 5.5.
<a4j:commandLink> - 5.6.
<a4j:jsFunction> - 5.7.
<a4j:poll> - 5.8.
<a4j:push> - 5.8.1. Setting up Push
- 5.8.2. Server-side Push methods
- 5.8.3. Client-side Push methods
- 5.8.4. Push Topics
- 5.8.5. Handling a push message
- 5.8.6. Handling a push subscription
- 5.8.7. Using TopicsContext to publish message
- 5.8.8. Integrating Push with CDI events
- 5.8.9. Push and JMS integration
- 5.8.10. Reference data
This chapter details the basic components that respond to a user action and submit an Ajax request.
5.1. <a4j:ajax>
The
<a4j:ajax> behavior allows Ajax capability to be added to a non-Ajax component. The non-Ajax component must implement the ClientBehaviorHolder interface for all the event attributes that support behavior rendering.
5.1.1. Basic usage
The
<a4j:ajax> behavior is placed as a direct child to the component that requires Ajax support.
Point the
event attribute to the standard JSF event that triggers the behavior. If the event attribute is not defined, the behavior is triggered on the event that normally provides interaction behavior for the parent component.
Example 5.1. <a4j:ajax> example
<h:panelGrid columns="2"> <h:inputText id="myinput" value="#{userBean.name}"> <a4j:ajax event="keyup" render="outtext" /> </h:inputText> <h:outputText id="outtext" value="#{userBean.name}" /> </h:panelGrid>
5.1.2. Reference data
client-behavior-renderer-type:org.ajax4jsf.behavior.Ajaxbehavior-id:org.ajax4jsf.behavior.Ajaxhandler-class:org.richfaces.view.facelets.html.AjaxHandlerbehavior-class:org.ajax4jsf.component.behavior.AjaxBehaviorclient-behavior-renderer-class:org.ajax4jsf.renderkit.AjaxBehaviorRenderer