<?xml version='1.0' encoding='UTF-8'?>
<chapter>
  
      <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.Repeat</entry>
            </row>
            <row>
              <entry>component-family</entry>
              <entry>javax.faces.Data</entry>
            </row>
            <row>
              <entry>component-class</entry>
              <entry>org.ajax4jsf.component.html.HtmlAjaxRepeat</entry>
            </row>
            <row>
              <entry>renderer-type</entry>
              <entry>org.ajax4jsf.components.RepeatRenderer</entry>
            </row>
          </tbody>
        </tgroup>
      </table></para>
    
    <section>
      <title>Creating on a page</title>
      <para>The component definition on a page is the same as for the <emphasis >
        <property>&quot;facelets&quot;</property>
       </emphasis> component:</para>
			<programlisting role="XML"><![CDATA[<a4j:repeat id="detail" value="#{bean.props}" var="detail">
	<h:outputText value="#{detail.someProperty}"/>
</a4j:repeat>]]></programlisting>
            <para>The output is generated according to a collection contained in <emphasis >
        <property>&quot;bean.props&quot;</property>
       </emphasis> with the <emphasis><property>&quot;detail&quot;</property></emphasis> key passed to child components.</para>
	   </section>
	  <section>
      <title>Dynamical creation of a component from Java code</title>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
	    <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlAjaxRepeat;
...
HtmlAjaxRepeat repeater = new HtmlAjaxRepeat ();
...
]]></programlisting>
    </section>
    <section>
      <title>Key attributes and ways of usage</title>
      <para>The main difference of this component from iterative components of other libraries is a special <emphasis >
        <property>&quot;ajaxKeys&quot;</property>
       </emphasis> attribute. This attribute defines strings that are updated after an Ajax request. As a result it becomes easier to update several child components separately without updating the whole page.</para>

<programlisting role="XML"><![CDATA[<a4j:poll intervall="1000" action="#{repeater.action}" reRender="list">
...
<table>
 <tbody>
   <a4j:repeat value="#{bean.props}" var="detail" binding="#{repeater.myRepeat}"
	 id="list" ajaxKeys="#{repeater.ajaxedRowsSet}">
	 </tr>
	   <td>
	    <h:outputText value="detail.someProperty">
	    </td>
	  </tr>
   </a4j:repeat>
   <tbody>
<table>
]]></programlisting>

      <para>Thus, a list with a table structure from <emphasis >
        <property>&quot;bean.props&quot;</property>
       </emphasis> is output.</para>
	   <para>In the above-mentioned example the component <emphasis role="bold">
        <property>&lt;a4j:poll&gt;</property>
       </emphasis> sends Ajax requests every second, calling the <emphasis >
        <property>&quot;action&quot;</property>
       </emphasis> method of the  <emphasis >
        <property>&quot;repeater&quot;</property>
       </emphasis> bean. 	   
	   </para>
	    <note>
    <title>Note:</title>
    <para>The <emphasis role="bold">
        <property>&lt;a4j:repeater&gt;</property>
       </emphasis> component is defined as fully updated, but really updated there are only the strings which rowKeys includes into the set <emphasis >
        <property>&quot;ajaxRowSet&quot;</property>
       </emphasis> defined in the <emphasis >
        <property>&quot;ajaxKeys&quot;</property>
       </emphasis> attribute </para>
	   <para>The set could be defined during the action method processing using data on a model from the property <emphasis >
        <property>&quot;repeater.myRepeat&quot;</property>
       </emphasis></para>
  </note>
<para>One more benefit of this component is absence of strictly defined markup as JSF HTML DataTable and Tomahawk DataTable has, hence the components could be used more flexibly anywhere where it&apos;s necessary to output the results of selection from some collection.</para>
<para>The next example shows collection output as a plain HTML list</para>
	  <programlisting role="XML"><![CDATA[<ul>
      <a4j:repeat ...>
	    <li>...<li/>
	     ...
	    <li>...<li/>
      </a4j:repeat>
</ul>
]]></programlisting>
      <para>All other general attributes are defined according to the similar attributes of iterative components (<emphasis role="bold">
        <property>&lt;h:dataTable&gt;</property>
       </emphasis> or <emphasis role="bold">
        <property>&lt;ui:repeat&gt;</property>
       </emphasis>) and are used in the same way.</para>
    </section>
	
  <section>
    <title>Relevant resources links</title>
	<para>
	  <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/repeat.jsf?c=repeat">Here
	  </ulink>  you can see the example of <emphasis role="bold"
	    ><property>&lt;a4j:repeat&gt;</property></emphasis> usage and sources for the given example. 
	</para>
  </section>	
</chapter>