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.2.  < a4j:actionparam > available since 3.0.0

The <a4j:actionparam> component combines the functionality of both JSF <f:param> and <f:actionListener> and allows to assign the value to the property of the manager bean directly using the assignTo attribute.

Table 6.3. a4j : actionparam attributes

Attribute Name Description
actionListenerA method binding that refers to a method with this signature: void methodName(ActionEvent)
assignToEL expression for updatable bean property. This property will be updated if the parent command component performs an actionEvent.
binding JSF: The attribute takes a value-binding expression for a component property of a backing bean
converter JSF: ID of a converter to be used or a reference to a converter.
id JSF: Every component may have a unique id that is automatically created if omitted
nameA name of this parameter
noEscapeIf set to true, the value will not enclosed within single quotes and there will be no escaping of characters. This allows the use of the value as JavaScript code for calculating value on the client-side. This doesn't work with non-AJAX components.
value JSF: An initial value or a value binding

Table 6.4. Component identification parameters


Simple component definition example:


<a4j:actionparam noEscape="true" name="param1" value="getMyValue()" assignTo="#{bean.prop1}" />


import org.ajax4jsf.component.html.HtmlActionParameter;

HtmlActionParameter myActionParameter = new HtmlActionParameter();

The component <a4j:actionparam> is a combination of the functionality of two JSF tags: <f:param> and <f:actionListener> .

At the render phase, it's decoded by parent component ( <h:commandLink> or like) as usual. At the process request phase, if the parent component performs an action event, update the "value" specified in the "assignTo" attribute as its "value" . If a "converter" attribute is specified, use it to encode and decode the "value" to a string stored in the html parameter. To make the "assignTo" attribute usable add the actionParam instance to the parent component as an action listener.

<a4j:actionparam> has a "noEscape" attribute. If it is set to "true", the "value" is evaluated as a JavaScript code.


    var foo = "bar";
<a4j:actionparam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />

The <a4j:param> extends <f:param> , so the "name" attribute is mandatory. Otherwise, the "value" misses due missing the request parameter name for it.

Vizit the ActionParamter page at RichFaces LiveDemo for examples of component usage abd their sources.

More information can be found on the Ajax4jsf Users Forum.

More information about <f:param> and <f:actionListener> can be found in Sun JSF TLD documentation.