Component identification parameters

Name | Value
--- | ---
component-type | org.ajax4jsf.Repeat
component-family | javax.faces.Data
component-class | org.ajax4jsf.component.html.HtmlAjaxRepeat
renderer-type | org.ajax4jsf.components.RepeatRenderer

## Creating on a page

The component definition on a page is the same as for the "facelets" component:

    <a4j:repeat id="detail" value="#{bean.props}" var="detail">
    	<h:outputText value="#{detail.someProperty}"/>
    </a4j:repeat>

The output is generated according to a collection contained in "bean.props" with the "detail" key passed to child components.

## Dynamical creation of a component from Java code

Example:

    import org.ajax4jsf.component.html.HtmlAjaxRepeat;
    ...
    HtmlAjaxRepeat repeater = new HtmlAjaxRepeat ();
    ...

## Key attributes and ways of usage

The main difference of this component from iterative components of other libraries is a special "ajaxKeys" 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.

    ...
        <a4j:poll intervall="1000" action="#{repeater.action}" reRender="text">
            <table>
                <tbody>
                    <a4j:repeat value="#{bean.props}" var="detail" ajaxKeys="#{repeater.ajaxedRowsSet}">
                        <tr>
                            <td>
                                <h:outputText value="detail.someProperty" id="text"/>
                            </td>
                        </tr>
                    </a4j:repeat>
                </tbody>
            </table>
        </a4j:poll>
    ...

Thus, a list with a table structure from "bean.props" is output.

In the above-mentioned example the component <a4j:poll> sends Ajax requests every second, calling the "action" method of the "repeater" bean.

Note:

The <a4j:repeater> component is defined as fully updated, but really updated there are only the strings which rowKeys includes into the set "ajaxRowSet" defined in the "ajaxKeys" attribute

The set could be defined during the action method processing using data on a model from the property "repeater.myRepeat"

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's necessary to output the results of selection from some collection.

The next example shows collection output as a plain HTML list

    <ul>
          <a4j:repeat ...>
    	    <li>...<li/>
    	     ...
    	    <li>...<li/>
          </a4j:repeat>
    </ul>

All other general attributes are defined according to the similar attributes of iterative components ( <h:dataTable> or <ui:repeat> ) and are used in the same way.

## Relevant resources links

Here you can see the example of <a4j:repeat> usage and sources for the given example.