BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.databinding.repeater
Class Repeater

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.DataSourceTag
                  extended by com.bea.wlw.netui.tags.databinding.repeater.Repeater
All Implemented Interfaces:
DataAccessProvider, HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class Repeater
extends DataSourceTag
implements DataAccessProvider

The <netui-data:repeater> tag is a markup-generic tag that repeats over a data set. The repeater tag set is used to render data from a data set into a page. The repeater itself does not render any markup. Instead, the markup from its contained tags is rendered to create the content generated by this tag. The tags in the repeater tag set are as follows:

TagDescription
RepeaterHeaderRenders once in the HEADER state.
RepeaterItemRenders once in the ITEM state.
RepeaterFooterRenders once in the FOOTER state.
PadUsed to convert irregular data sets into regular data sets through padding or truncating the output.
ChoiceUsed to render different UI for a particular data item bsaed on the result of calling a "decision" method with the ChoiceMethod tag. This is allowed only within the RepeaterItem tag.
ChoiceMethodUsed to define the choices when rendering an item with a RepeaterItem tag. This is allowed only within the RepeaterItem tag.

The repeater can render in two modes; the first mode is a simple mode where the body of the repeater 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 an unordered HTML list of items that are list items which contain the lastName, firstName of the current "customer" in the data set.

 <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 tags above are used to delineate iteration boundaries on the body of a <netui-data:repeater> tag. In this case, if one of the above tags is present, any content directly in the body of the repeater is not rendered; rather, the content inside the structured tags of the repeater is rendered.

For example, the following will render the same output as the example shown above, but it uses the structured tags for rendering the {pageFlow.customers} expression:

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

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
defaultTextNoNoNo
The text that is rendered if the data set is null or contains zero items.
ignoreNullsNoNoNo
A boolean to set if rendering a sparse data set that can contain nulls which should be ignored.

See Also:
RepeaterHeader, RepeaterItem, RepeaterFooter, Serialized Form
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="{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/
Beadoc.see:
<netui-data:repeater> Tag Sample, Presenting Complex Data Sets in JSPs (Repeater Tags section)
Beadoc.tagdescription:

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
RepeaterHeaderRenders once at the start of the iteration.
RepeaterItemRenders once for each iteration.
RepeaterFooterRenders once at the end of the iteration.
PadUsed to convert irregular data sets into regular data sets through padding or truncating the output.
ChoiceUsed 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.
ChoiceMethodUsed 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>

Field Summary
static int END
          A Repeater rendering state that signals the end of repeater rendering.
static int FOOTER
          A Repeater rendering state that signals the rendering of the FOOTER.
static int HEADER
          A Repeater rendering state that signals the rendering of the HEADER.
static int INIT
          A Repeater rendering state that signals the beginning of repeater rendering.
static int ITEM
          A Repeater rendering state that signals the rendering of the ITEM.
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
Repeater()
           
 
Method Summary
 void addContent(String content)
          Add content to the content that is being buffered by this tag.
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 int getCurrentIndex()
          Get the index of the current iteration through the body of this tag.
 Object getCurrentItem()
          Get the item that is currently being rendered by this repeating tag.
 Object getCurrentMetadata()
          Get the metadata for the current item.
 String getDefaultText()
          Get the defaultText attribute.
 boolean getIgnoreNulls()
          Get a boolean that describes whether the repeater should ignore null items encountered while iterating over a data set.
 DataAccessProvider getProviderParent()
          Get the parent DataAccessProvider for this tag.
 int getRenderState()
          Get the current render state for the repeater.
 String getTagName()
          Get the name of this tag.
protected  void localRelease()
          Reset all of the fields of this tag.
 void registerChildTag(RepeaterComponent repeaterComponent)
           
 void setDefaultText(String defaultText)
          Set the text that will be rendered if the dataSource expression references a null object and the defaultText attribute is non-null.
 void setIgnoreNulls(boolean ignoreNulls)
          Set a boolean that describes whether the repeater should ignore null items encountered while iterating over a data set.
 void setPadContext(PadContext padContext)
           
 
Methods inherited from class com.bea.wlw.netui.tags.DataSourceTag
addNamingInterceptor, doNaming, evaluateDataSource, getDataSource, qualifyAttribute, removeNamingInterceptor, setDataSource
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bea.wlw.netui.tags.DataAccessProvider
getDataSource, setDataSource
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

INIT

public static final int INIT
A Repeater rendering state that signals the beginning of repeater rendering.

See Also:
Constant Field Values

HEADER

public static final int HEADER
A Repeater rendering state that signals the rendering of the HEADER. The body renders in the HEADER state once.

See Also:
Constant Field Values

ITEM

public static final int ITEM
A Repeater rendering state that signals the rendering of the ITEM. The body renders in the ITEM state once for each item in the data set.

See Also:
Constant Field Values

FOOTER

public static final int FOOTER
A Repeater rendering state that signals the rendering of the FOOTER. The body renders in the FOOTER state once.

See Also:
Constant Field Values

END

public static final int END
A Repeater rendering state that signals the end of repeater rendering.

See Also:
Constant Field Values
Constructor Detail

Repeater

public Repeater()
Method Detail

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Specified by:
getTagName in class AbstractBaseTag
Returns:
a constant String representing the name of this tag.

getIgnoreNulls

public boolean getIgnoreNulls()
Get a boolean that describes whether the repeater should ignore null items encountered while iterating over a data set.

Returns:
true if ignoring nulls; false otherwise

setIgnoreNulls

public void setIgnoreNulls(boolean ignoreNulls)
Set a boolean that describes whether the repeater should ignore null items encountered while iterating over a data set.

Parameters:
ignoreNulls - whether or not to ignore nulls
Beadoc.attributedescription:
Boolean. If set to true, any null iteration items in the data set will be ignored.
Beadoc.attributesyntaxvalue:
boolean_ignoreNulls
Beadoc.databindable:
false

setPadContext

public void setPadContext(PadContext padContext)
Parameters:
padContext -

getDefaultText

public String getDefaultText()
Get the defaultText attribute.

Returns:
the default text or null if unset.

setDefaultText

public void setDefaultText(String defaultText)
Set the text that will be rendered if the dataSource expression references a null object and the defaultText attribute is non-null.

Parameters:
defaultText - the default text
Beadoc.attributedescription:
The text to render if the dataSource attribute references a null data set.
Beadoc.attributesyntaxvalue:
string_defaultText
Beadoc.databindable:
false

getCurrentIndex

public int getCurrentIndex()
Get the index of the current iteration through the body of this tag. This data can be accessed using the expression container.index on an attribute of a databindable NetUI tag that is contained within the repeating body of this tag. This expression is only valid when the dataset is being rendered.

Specified by:
getCurrentIndex in interface DataAccessProvider
Returns:
the integer index of the current data item in the data set
See Also:
DataAccessProvider

getCurrentItem

public Object getCurrentItem()
Get the item that is currently being rendered by this repeating tag. This can be accessed using the expression expression.item on an attribute of a databindable NetUI tag that is contained within the repeating body of this tag. The expression is only valid when the dataset is being rendered.

Specified by:
getCurrentItem in interface DataAccessProvider
Returns:
the current item in the data set
See Also:
DataAccessProvider

getCurrentMetadata

public Object getCurrentMetadata()
Get the metadata for the current item. This method is not supported by this tag.

Specified by:
getCurrentMetadata in interface DataAccessProvider
Returns:
the current metadata or null if no metadata can be found or metadata is not supported by a DataAccessProvider implementation
Throws:
UnsupportedOperationException - this tag does not support this method from the DataAccessProvider interface
See Also:
DataAccessProvider

getProviderParent

public DataAccessProvider getProviderParent()
Get the parent DataAccessProvider for this tag. If this tag is contained within a DataAccessProvider, the containing DataAccessProvider is available through the expression container.container. Any valid properties of the parent DataAccessProvider can be accessed through this expression. This method will return null if there is no parent DataAccessProvider

Specified by:
getProviderParent in interface DataAccessProvider
Returns:
a containing DataAccessProvider if one exists, null otherwise.
See Also:
DataAccessProvider

getRenderState

public int getRenderState()
Get the current render state for the repeater. This tag is used by child tags to access the current location in the repeater's rendering lifecycle.

Returns:
an integer that represents the current state of the grid; this is one of INIT, HEADER, ITEM,FOOTER, or END.

addContent

public void addContent(String content)
Add content to the content that is being buffered by this tag. All content written by the body of this tag is added to this buffer. The buffer is rendered at the end of the tag's lifecycle if no fatal errors have occurred during this tag's lifecycle.

Parameters:
content - content that this tag should render.

registerChildTag

public void registerChildTag(RepeaterComponent repeaterComponent)
Parameters:
repeaterComponent - the RepeaterComponent to register with the Repeater parent

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_BODY if an error occurs; EVAL_BODY_BUFFERED otherwise
Throws:
javax.servlet.jsp.JspException - if an error occurs that can not be reported in the page

doAfterBody

public int doAfterBody()
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
SKIP_BODY if an error occurs or the data set has been rendered; EVAL_BODY_AGAIN otherwise

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE
Throws:
javax.servlet.jsp.JspException - if an error occurs that can not be reported in the page

localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class DataSourceTag

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.