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

expand all
6.1.2.1. Description
6.1.2.2. Details of Usage
6.1.2.3. Reference Data
6.1.2.4. Relevant Resources Links

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

The <a4j:actionparam> component has 3 main attributes:

Example:


...
<h:form id="form">
    <a4j:commandButton value="Set Name to Alex" reRender="rep">
        <a4j:actionparam name="username" value="Alex" assignTo="#{actionparamBean.name}"/>
    </a4j:commandButton>
    <br/>
    <h:outputText id="rep" value="Name: #{actionparamBean.name}"/>
</h:form>
...

There is a managed bean:

...

public class ActionparamBean {
    private String name = "John";
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
...

You can use <a4j:actionparam> not only with Ajax components, but with non-ajax command component also. This feature allows to update model values without invoking even a single line of Java code on the server side. The usage of this feature you can find at ActionParameter Usage page of RichFaces LiveDemo.

If you need to convert the value before the "Update Model" phase you can specify the converter in the "converter" attribute.

Note:

The property is assigned with a parameter value on the "Update Model" phase. Therefore if the validation of the form is failed, this phase will be skipped and the property won't be updated.

It is possible to use JavaScript expression or function in the "value" attribute. In this case the "noEscape" attribute should be set to "true". The result of this JavaScript invocation is sent to the server as a value of <a4j:actionparam> .

Table of <a4j:actionparam> attributes.


Visit the ActionParameter page at RichFaces LiveDemo for examples of component usage and 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.