<?xml version='1.0' encoding='UTF-8'?>
<chapter>
          <chapterinfo>
                    <keywordset>
                              <keyword>a4j:repeat</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.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
                                        <property>facelets</property> 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
                                        <code>bean.props</code> with the <code>detail</code> key
                              passed to child components.</para>
          </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.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 row keys 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[...
<table>
	<tbody>
		<a4j:repeat value="#{repeatBean.items}" var="item"
		     		ajaxKeys="#{updateBean.updatedRow}">
			<tr>
				<td><h:outputText value="#{item.code}" id="item1" /></td>
				<td><h:outputText value="#{item.price}" id="item2" /></td>
			</tr>
		</a4j:repeat>
	</tbody>
</table>
...]]></programlisting>
                    <note>
                              <title>Note:</title>
                              <para>The <emphasis role="bold">
                                                  <property>&lt;a4j:repeat&gt;</property>
                                        </emphasis> component is defined as fully updated, but
                                        really updated there are only the row keys which 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
                                                  <code>repeater.myRepeat</code>
                              </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"
                                        >On the component LiveDemo page</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>
