Keywords: a4j:actionparam

JBoss.org Community Documentation

- Prev
- Next

## 6.3. < a4j:actionparam >

### 6.3.1. Description

The <a4j:actionparam> component combines the functionality of both JSF components: <f:param> and <f:actionListener> .

More information about <f:param> and <f:actionListener> can be found here.

Table 6.5. a4j : actionparam attributes

Attribute Name | Description
--- | ---
actionListener | actionListener
assignTo | EL expression for updatable bean property. This property will be updated if the parent command component performs an actionEvent.
binding | The attribute takes a value-binding expression for a component property of a backing bean
converter | ID of a converter to be used or a reference to a converter.
id | Every component may have a unique id that is automatically created if omitted
name | A name of this parameter
noEscape | If 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 | An initial value or a value binding

Table 6.6. Component identification parameters

Name | Value
--- | ---
component-type | org.ajax4jsf.ActionParameter
component-class | org.ajax4jsf.component.html.HtmlActionParameter

### 6.3.2. Creating on a page

Simple component definition example:

Example:

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

### 6.3.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlActionParameter;

    ...

    HtmlActionParameter myActionParameter = new HtmlActionParameter();

    ...

### 6.3.4. Key attributes and ways of usage

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.

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

Example:

    ...

            <script>

                ...

                 var foo = "bar";

                ...

            </script>

            ...

            <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.

### 6.3.5. Relevant resources links

Here you can see the example of <a4j:actionparam> usage and sources for the given example.

More information can be found on the Ajax4jsf Users Forum.

- Prev6.2. < a4j:keepAlive >
- Top of page
- Front page
- Next6.4. < a4j:commandButton >