### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.6.13. < a4j:repeat > available since 3.0.0

expand all

#### 6.6.13.1. Description

The <a4j:repeat> component implements a basic iteration component that allows to update a set of its children with Ajax.

Table 6.117. a4j : repeat attributes

Attribute Name | Description
--- | ---
ajaxKeys | This attribute defines row keys that are updated after an AJAX request.
binding | JSF: The attribute takes a value-binding expression for a component property of a backing bean
componentState | It defines EL-binding for a component state for saving or redefinition.
first | A zero-relative row number of the first row to display
id | JSF: Every component may have a unique id that is automatically created if omitted
rendered | JSF: If "false", this component is not rendered
rowKeyConverter | Converter for a row key object
rowKeyVar | The attribute provides access to a row key in a Request scope.
rows | HTML: A number of rows to display, or zero for all remaining rows in the table
stateVar | The attribute provides access to a component state on the client side.
value | JSF: The current value for this component.
var | A request-scope attribute via which the data object for the current row will be used when iterating

Table 6.118. 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

#### 6.6.13.2. Creating the Component with a Page Tag

To create the simplest variant on a page use the following syntax:

    <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.

#### 6.6.13.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlAjaxRepeat;

    ...

    HtmlAjaxRepeat repeater = new HtmlAjaxRepeat ();

    ...

#### 6.6.13.4. Details of usage

The <a4j:repeat> component is similar to Facelets <ui:repeat> tag, which is used to iterate through a collection of objects binded with JSF page as EL expression. The main difference of the <a4j:repeat> is a possibility to update particular components (it's children) instead of all using Ajax requests. The feature that makes the component different is a special "ajaxKeys" attribute that defines row that are updated after an Ajax request. As a result it becomes easier to update several child components separately without updating the whole page.

    ...

    <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>

     ...

The example above the <a4j:repeat> points to an method that contains row keys to be updated.

## Note:

The <a4j:repeat> component is defined as fully updated, but really updated there are only the row keys which defined in the "ajaxKeys" attribute.

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.

#### 6.6.13.5. Relevant resources links

Vizit the Repeat page at RichFaces LiveDemo for examples of component usage and their sources.

- Prev6.6.12. < rich:extendedDataTable > ...
- Top of page
- Front page
- Next6.6.14. < rich:scrollableDataTable >...