<?xml version='1.0' encoding='UTF-8'?>
<chapter>
  <chapterinfo>
    <keywordset>
      <keyword>a4j:commandLink</keyword>
    </keywordset>
  </chapterinfo>
      <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.CommandLink</entry>
            </row>
            <row>
              <entry>component-family</entry>
              <entry>javax.faces.Command </entry>
            </row>
            <row>
              <entry>component-class</entry>
              <entry>org.ajax4jsf.component.html.HtmlAjaxCommandLink</entry>
            </row>
            <row>
              <entry>renderer-type</entry>
              <entry>org.ajax4jsf.components.AjaxCommandLinkRenderer </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    
    <section>
      <title>Creating on a page</title>
      <para>To create the simplest variant on a page use the following syntax:</para>
      <para>
        <emphasis role="bold">Example:</emphasis>
      </para>
      <programlisting role="XML"><![CDATA[...
   <a4j:commandLink reRender="someData" action="#{bean.action1}" value="Link"/>
...]]></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.HtmlAjaxCommandLink;
...
HtmlAjaxCommandLink myLink = new HtmlAjaxCommandLink();
...
]]></programlisting>
    </section>
    <section>
      <title>Key attributes and ways of usage</title>
      <para>The <emphasis role="bold"><property>&lt;a4j:commandLink&gt;</property></emphasis> component is used in the same way as the <emphasis role="bold"><property>&lt;h:commandLink&gt;</property></emphasis> component, but with definition of the area that is updated after the response comes back from the server.</para>
      <para>This definition of the component provides a link, and a click on the link causes an Ajax form
        submit on the server, <code>&quot;action1&quot;</code> method performance, and rendering of the component 
        with <code>&quot;someData&quot;</code> id after the response comes back from the server.</para>
      <tip>
        <title>Tip:</title>
        <para>The example in the &quot;Creation on a page&quot; section generates the following HTML code:</para>
        <programlisting role="XML"><![CDATA[...
<a href="#" onclick="A4J.AJAX.Submit(?"request parameters"); return false;">
	  <span>Link</span>
</a>
...]]></programlisting>
        <para>If you click on the generated anchor the utility method <code>A4J.AJAX.Submit()</code> is fired. 
		The method performs an Ajax request as the Ajax support is built-in. It&apos;s not necessary to add nested <emphasis role="bold"><property>&lt;a4j:support /&gt;</property></emphasis> to the <emphasis role="bold"><property>&lt;a4j:commandLink /&gt;</property></emphasis> component.</para>
      </tip>
     
	 <!--<note>
      <title>Note:</title>
      
	  </note>-->
	  <para>Common JSF navigation could be performed after Ajax submit and partial rendering, but Navigation Case must be defined as <emphasis role="bold"><property>&lt;redirect/&gt;</property></emphasis> in order to avoid problems with some browsers.</para>
      <para>As any Core Ajax component sending Ajax requests and processing server responses <emphasis role="bold"><property>&lt;a4j:commandLink&gt;</property></emphasis> has all attributes described above (see <emphasis role="bold"><property>&lt;a4j:support&gt;</property></emphasis> <link linkend="support">chapter</link>) that provide the required behavior of requests sending (delay, limitation of submit area and rendering, etc.)</para>
      <para>
        Information about the <emphasis><property>&quot;process&quot;</property></emphasis> attribute usage you can find <link linkend="process">&quot; Decide what to process &quot; </link> guide section.
      </para>
    </section>
	
  <section>
    <title>Relevant resources links</title>
	<para>Vizit
	    <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/commandLink.jsf?c=commandLink">CommandLink demo</ulink> page at RichFaces 
		live demo for examples of component usage and their sources.
	</para>
	<para>Useful articles:</para>
	<itemizedlist>
	  <listitem>
	    <para>
	      <ulink url="http://www.jboss.org/community/docs/DOC-11850">How to use "window.confirm" JavaScript with &lt;a4j:commandLink&gt; "onclick" attribute</ulink> 
		  in RichFaces cookbook at JBoss portal.
		</para>
	  </listitem>
	</itemizedlist>
  </section>
  
</chapter>