JBoss.orgCommunity Documentation
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
Table 6.4. Component identification parameters
Name | Value |
---|---|
component-type | org.ajax4jsf.ActionParameter |
component-class | org.ajax4jsf.component.html.HtmlActionParameter |
Simple component definition example:
Example:
<a4j:actionparam noEscape="true" name="param1" value="getMyValue()" assignTo="#{bean.prop1}" />
Example:
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.
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.
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.