<section role="NotInToc" id="a4j_actionparam">
    <title>
        &lt;
        a4j:actionparam
        &gt;
        <emphasis role="since">
            <superscript>available since
                <emphasis role="version">3.0.0</emphasis>
            </superscript>
        </emphasis>
    </title>
    <section role="NotInToc">
        <sectioninfo>
            <keywordset>
                <keyword>a4j:actionparam</keyword>
            </keywordset>
        </sectioninfo>
        <title>Description</title>
        <para>
            The
            <emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis>
            component combines the functionality of
            <emphasis role="bold">
                <property>&lt;f:param&gt;</property>
            </emphasis>
            and
            <emphasis role="bold">
                <property>&lt;f:actionListener&gt;</property>
            </emphasis>
            and allows to assign the value to the property of the managed bean directly using the
            <emphasis>
                <property>&quot;assignTo&quot;</property>
            </emphasis>
            attribute.
        </para>

    </section>
    <section>
        <title>Details of Usage</title>
        <para>
            The
            <emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis>
            component has 3 main attributes:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    <emphasis>
                        <property>&quot;name&quot;</property>
                    </emphasis>
                    defines a name of this parameter
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis>
                        <property>&quot;value&quot;</property>
                    </emphasis>
                    defines initial value of this parameter or a value binding
                </para>
            </listitem>
            <listitem>
                <para>
                    <emphasis>
                        <property>&quot;assignTo&quot;</property>
                    </emphasis>
                    defines updatable bean property. This property will be updated if the parent
                    command component performs an actionEvent. The update occurs in the same phase as the actionEvent is processed (<literal>INVOKE_APPLICATION</literal>, <literal>PROCESS_VALIDATIONS</literal>, or <literal>APPLY_REQUEST_VALUES</literal>, depending on the values of the
                    <emphasis>
                        <property>&quot;immediate&quot;</property>
                    </emphasis>
                    and
                    <emphasis>
                        <property>&quot;bypassUpdates&quot;</property>
                    </emphasis>
                    attributes).
                </para>
            </listitem>
        </itemizedlist>
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>
        <programlisting role="XML"><![CDATA[...
<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>
...]]></programlisting>
        <para>
            There is a managed bean:
        </para>
        <programlisting role="JAVA"><![CDATA[...
public class ActionparamBean {
    private String name = "John";

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
...]]></programlisting>
        <para>
            You can use
            <emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis>
            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
            <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=actionparam&amp;tab=usage">
                ActionParameter Usage
            </ulink>
            page of RichFaces LiveDemo.
        </para>
        <para>
            If you need to convert the value before the &quot;Update Model&quot; phase
            you can specify the converter in the
            <emphasis>
                <property>&quot;converter&quot;</property>
            </emphasis>
            attribute.
        </para>
        <note>
            <title>Note:</title>
            <para>
                The property is assigned with a parameter value on the &quot;Update Model&quot; phase. Therefore if the
                validation of the form is failed, this phase will be skipped and the property won&apos;t be updated.
            </para>
        </note>
        <para>
            It is possible to use JavaScript expression or function in the
            <emphasis>
                <property>&quot;value&quot;</property>
            </emphasis>
            attribute.
            In this case the
            <emphasis>
                <property>&quot;noEscape&quot;</property>
            </emphasis>
            attribute should be set to &quot;true&quot;.
            The result of this JavaScript invocation is sent to the server as a value of
            <emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis>
            .
        </para>
    </section>
    <section>
        <title>Reference Data</title>
        <para>
            <ulink url="&tlddoc;a4j/actionparam.html">Table of
                &lt;a4j:actionparam&gt;
                attributes</ulink>.
        </para>
        <table frame="all">
            <title>Component Identification Parameters</title>
            <tgroup cols="2">
                <thead>
                    <row>
                        <entry>Name</entry>
                        <entry>Value</entry>
                    </row>
                </thead>
                <tbody>
                    <row>
                        <entry>component-type</entry>
                        <entry>org.ajax4jsf.ActionParameter</entry>
                    </row>

                    <row>
                        <entry>component-class</entry>
                        <entry>org.ajax4jsf.component.html.HtmlActionParameter</entry>
                    </row>

                </tbody>
            </tgroup>
        </table>
    </section>
    <section>
        <title>Relevant Resources Links</title>
        <para>
            Visit the
            <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=actionparam">
                ActionParameter</ulink>
            page at RichFaces LiveDemo for examples of component usage and their sources.
        </para>
        <para>
            More information can be found on the
            <ulink
                url="http://www.jboss.com/index.html?module=bb&amp;op=viewtopic&amp;p=4063764">Ajax4jsf Users
            Forum</ulink>.
        </para>
        <para>
            More information about
            <emphasis role="bold">
                <property>&lt;f:param&gt;</property>
            </emphasis>
            and
            <emphasis role="bold">
                <property>&lt;f:actionListener&gt;</property>
            </emphasis>
            can be found in
            <ulink url="http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/index.html">Sun JSF
            TLD documentation</ulink>.
        </para>
    </section>
</section>
