netui-data:repeater Tag

<netui-data:repeater> Tag

The <netui-data:repeater> tag iterates over a data set to render it as HTML.

Syntax

<netui-data:repeater
    dataSource="expression_datasource"
    [defaultText="string_defaultText"]
    [ignoreNulls="boolean_ignoreNulls"] />

Description

The <netui-data:repeater> tag iterates over a data set to render it as HTML. The HTML is specified either directly within the the body of <netui-data:repeater> tag or within an associated set of "helper" tags. The "helper" tags are listed below.

TagDescription
<netui-data:repeaterHeader> Renders once at the start of the iteration.
<netui-data:repeaterItem> Renders once for each iteration.
<netui-data:repeaterFooter> Renders once at the end of the iteration.
<netui-data:pad> Used to convert irregular data sets into regular data sets through padding or truncating the output.
<netui-data:choice> Used to conditionally render data in the data set based on the result of calling a decision method. This is allowed only within the <netui-data:repeaterItem> tag.
<netui-data:choiceMethod> Used to define the decision method used when conditionally rendering data. This is allowed only within the <netui-data:repeaterItem> tag.

The <netui-data:repeater> tag can render in two modes; the first mode is a simple mode where the body of the <netui-data:repeater> tag is rendered once for each item in the data set. In this case, none of the other tags above are present in the repeater body. For example, the following will render the items in the "customers" data set as an unordered HTML list.

     <ul>
         <netui-data:repeater dataSource="{pageFlow.customers}">
             <li><netui:label value="{container.item.lastName}, {container.item.firstName}"/></li>
         </netui-data:repeater>
     </ul>

The second mode is a more structured mode of rendering where the "helper" tags are used to define the rendering of the data set. In this case, if one of the helper tags is present, any HTML markup directly in the body of the <netui-data:repeater> tag is not rendered; rather, the HTML markup inside the helper tags is rendered.

For example, the following will render the same output as the example shown above, but it uses the "helper" tags for rendering the HTML markup:

     <netui-data:repeater dataSource="{pageFlow.customers}">
         <netui-data:repeaterHeader>
             <ul>
         </netui-data:repeaterHeader>
         <netui-data:repeaterItem>
             <li><netui:label value="{container.item.lastName}, {container.item.firstName}"/></li>
         </netui-data:repeaterItem>
         <netui-data:repeaterFooter>
             </ul>
         </netui-data:repeaterFooter>
     </netui-data:repeater>

Attributes

dataSource

The dataSource attribute determines both (1) the source of populating data for the tag and (2) the object to which the tag submits data.

For example, assume that the Controller file (= JPF file) contains a Form Bean with the property foo. Then the following <netui:textBox> tag will (1) draw populating data from the Form Bean's foo property and (2) submit user defined data to the same property.

    <netui:textBox dataSource="{actionForm.foo}" />

The dataSource attribute takes either a data binding expression or the name of a Form Bean property. In the above example, <netui:textBox dataSource="foo" /> would have the exactly same behavior.

When the tag is used to submit data, the data binding expression must refer to a Form Bean property. In cases where the tag is not used to submit data, but is used for displaying data only, the data binding expression need not refer to a Form Bean property. For example, assume that myIterativeData is a member variable on the Controller file ( = JPF file). The following <netui-data:repeater> tag draws its data from myIterativeData.

    <netui-data:repeater dataSource="{pageFlow.myIterativeData}">

 
RequiredSupports runtime expression evaluationData bindable
YesNoRead / Write

defaultTextThe text to render if the dataSource attribute references a null data set.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

ignoreNullsBoolean. If set to true, any null iteration items in the data set will be ignored.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

Sample

The following sample renders the data set as an HTML table. The table has two columns, "index" and "name", and each iteration over the data set is rendered as a row of the table.
    <netui-data:repeater dataSource="{pageFlow.myDataSet}">
        <netui-data:repeaterHeader>
            <table border="1">
                <tr>
                    <td><b>index</b></td>
                    <td><b>name</b></td>    
                </tr>
        </netui-data:repeaterHeader>
        <netui-data:repeaterItem>
            <tr>
                <td>
                    <netui:label value="{container.index}" />
                </td>
                <td>
                    <netui:label value="{container.item}" />
                </td>
            </tr>
        </netui-data:repeaterItem>
        <netui-data:repeaterFooter>
            </table>
        </netui-data:repeaterFooter>    
    </netui-data:repeater>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/repeater/

Related Topics

<netui-data:repeater> Tag Sample

Presenting Complex Data Sets in JSPs (Repeater Tags section)

<netui-data:repeaterHeader> Tag

<netui-data:repeaterItem> Tag

<netui-data:repeaterFooter> Tag