NetUI Tag Library Documentation (Version 1.0.2)

netui-data
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"] >
    ... JSP content ...
</netui-data:repeater>

Description

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.

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="pageInput.customers">
             <li><netui:span 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="pageInput.customers">
         <netui-data:repeaterHeader>
             <ul>
         </netui-data:repeaterHeader>
         <netui-data:repeaterItem>
             <li><netui:span value="${container.item.lastName}, ${container.item.firstName}"/></li>
         </netui-data:repeaterItem>
         <netui-data:repeaterFooter>
             </ul>
         </netui-data:repeaterFooter>
     </netui-data:repeater>

Attributes
dataSource
Required: Yes  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: No

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

defaultText
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

The text to render if the dataSource attribute references a null data set.
ignoreNulls
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: No

Boolean. If set to true, any null iteration items in the data set will be ignored.

Example

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="pageInput.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:span value="${container.index}" />
                </td>
                <td>
                    <netui: value="${container.item}" />
                </td>
            </tr>
        </netui-data:repeaterItem>
        <netui-data:repeaterFooter>
            </table>
        </netui-data:repeaterFooter>
    </netui-data:repeater>


Tag Information
Tag Classorg.apache.beehive.netui.tags.databinding.repeater.Repeater
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone