<?xml version='1.0' encoding='UTF-8'?>
<chapter>
    <chapterinfo>
        <keywordset><keyword>a4j:actionparam</keyword>
        </keywordset>
    </chapterinfo>
    <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>
    </para>
    <section>
        <title>Creating on a page</title>
        <para>Simple component definition example:</para>
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>
        <programlisting role="XML"><![CDATA[<a4j:actionparam noEscape="true" name="param1" value="getMyValue()" assignTo="#{bean.prop1}" />]]></programlisting>
    </section>
    <section>
        <title>Creating the Component Dynamically Using Java</title>
        <para>
            <emphasis role="bold">Example:</emphasis>
        </para>
        <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlActionParameter;
...
HtmlActionParameter myActionParameter = new HtmlActionParameter();
...
]]></programlisting>
    </section>
    <section>
        <title>Key attributes and ways of usage</title>
        <para>The component <emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis> is a combination of the functionality of two JSF tags: <emphasis role="bold">
                <property>&lt;f:param&gt;</property>
            </emphasis> and <emphasis role="bold">
                <property>&lt;f:actionListener&gt;</property>
            </emphasis>.</para>
        <para>At the render phase, it&apos;s decoded by parent component (<emphasis role="bold">
                <property>&lt;h:commandLink&gt;</property>
            </emphasis> or like) as usual. At the process request phase, if the parent component
            performs an action event, update the <emphasis><property>&quot;value&quot;</property></emphasis> specified in the <emphasis><property>&quot;assignTo&quot;</property></emphasis>
            attribute as its <emphasis><property>&quot;value&quot;</property></emphasis>. If a <emphasis><property>&quot;converter&quot;</property></emphasis> attribute is specified, use it to encode and
            decode the <emphasis><property>&quot;value&quot;</property></emphasis> to a string stored in the html parameter.</para>
        <para><emphasis role="bold">
                <property>&lt;a4j:actionparam&gt;</property>
            </emphasis>has a <emphasis><property>&quot;noEscape&quot;</property></emphasis> attribute. If it is set to
            <property>&quot;true&quot;</property>, the <emphasis><property>&quot;value&quot;</property></emphasis> is evaluated as a JavaScript code. </para>
        <para>
        <emphasis role="bold">Example:</emphasis>
        </para>
            <programlisting role="XML"><![CDATA[...
<script>
    ...
    var foo = "bar";
    ...
</script>
...
<a4j:actionparam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />
...]]></programlisting>
	<para>
		The <emphasis role="bold"><property>&lt;a4j:param&gt;</property></emphasis> extends 
	    <emphasis role="bold"><property>&lt;f:param&gt;</property></emphasis>, so the <emphasis><property>&quot;name&quot;</property></emphasis> attribute is mandatory.
	    Otherwise, the <emphasis><property>&quot;value&quot;</property></emphasis> misses due missing the request parameter name for it.
	</para>	
    </section>
  
  <section>
    <title>Relevant resources links</title>
	<para>
	    <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=actionparam">On the component LiveDemo page</ulink>
	    you can see the example of <emphasis role="bold"
	        ><property>&lt;a4j:actionparam&gt;</property></emphasis> usage and sources for the given example. 
	</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>	  
  </section> 	
</chapter>
