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 RepeaterItem

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.databinding.base.StructuredBaseTag
                  extended by com.bea.wlw.netui.tags.databinding.repeater.RepeaterComponent
                      extended by com.bea.wlw.netui.tags.databinding.repeater.RepeaterItem
All Implemented Interfaces:
HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class RepeaterItem
extends RepeaterComponent

This tag is used to render each item in the data set. The items in the data set are provided by this tag's Repeater parent and are available for databinding using the container databinding context. The current item is referenced using the container.item expression.

The RepeaterItem tag can only be uesd when directly contained by a Repeater tag, and a RepeaterItem is rendered during the Repeater's Repeater.ITEM rendering state.

By default, the RepeaterItem simply renders its body once for each of the items in the Repeater tag's data set.

A RepeaterItem has the ability to render different markup for each of the items that it renders. This is possible using the ChoiceMethod and Choice tags. These tags are used inside of the body to select which Choice tag to render and delineate each option that could be chosen.

See Also:
Repeater, RepeaterHeader, RepeaterFooter, Choice, Serialized Form
Example:
The following sample renders the data set as an HTML table. The <netui-data:repeaterItem> tag renders a new row in the table for each item in the data set.
    <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:
This tag is used to render an individual item in the data set as it is iterated over by the Repeater tag. As an individual item is being iterated over, it is available using the {container.item} databinding expression.

The <netui-data:repeaterItem> tag can only be uesd when directly contained by a <netui-data:repeater> tag.

By default, the <netui-data:repeaterItem> simply renders its body once for each of the items in the <netui-data:repeater> tag's data set.

A <netui-data:repeaterItem> has the ability to render different HTML markup for each of the items that it renders. This is possible using the ChoiceMethod and Choice tags. The <netui-data:choiceMethod> tag decides which <netui-data:choice> tag to render.


Field Summary
static int CHOOSE
          The RepeaterItem lifecycle state that runs through the body in order to find all of the possible Choice tags, their values, and the default Choice if present.
static int RENDER
          The RepeaterItem lifecycle state that runs through the body in order to render the body of the RepeaterItem.
 
Fields inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag
EMPTY_STRING
 
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
RepeaterItem()
           
 
Method Summary
 int doAfterBody()
          Render the result of having evalutaed the body.
 Object getChoiceValue()
          Get the value of a nested Choice tag whose value attribute corresponds to the value selected by executing the ChoiceMethod tag.
 int getRenderState()
          Get the current render state of the RepeaterItem.
 String getTagName()
          Get the name of this tag.
 boolean hasRenderedItem()
          Get a boolean that denotes that an item has been rendered for this RepeaterItem.
protected  void localRelease()
          Reset all of the fields of this tag.
 void registerChildTag(AbstractBaseTag tag)
          Register chlid tags that need to be handled specially by the RepeaterItem.
 int renderStartTag(int state)
          Render the start of this tag.
 void setChoiceValue(Object choiceValue)
          Set the value on a Choice tag whose value attribute matched the result of the result of invoking the ChoiceMethod.
 void setRenderedItem(boolean renderedItem)
          A boolean that denotes that an item has been rendered from the set of Choice tags that may be present in the body of a RepeaterItem tag.
 boolean shouldRender(Object value, boolean defaultItem)
          The decision method that the Choice tags use to determine if the calling Choice tag is the one that hsould render.
 void stopRendering()
           
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.repeater.RepeaterComponent
getCurrentRenderState, getRepeater, getValidContainerType, prepare, renderEndTag
 
Methods inherited from class com.bea.wlw.netui.tags.databinding.base.StructuredBaseTag
addContent, doEndTag, doStartTag, getContent, verifyAttributes, verifyStructure
 
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 javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

CHOOSE

public static final int CHOOSE
The RepeaterItem lifecycle state that runs through the body in order to find all of the possible Choice tags, their values, and the default Choice if present.

See Also:
Constant Field Values
Exclude:

RENDER

public static final int RENDER
The RepeaterItem lifecycle state that runs through the body in order to render the body of the RepeaterItem.

See Also:
Constant Field Values
Constructor Detail

RepeaterItem

public RepeaterItem()
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.

getChoiceValue

public Object getChoiceValue()
Get the value of a nested Choice tag whose value attribute corresponds to the value selected by executing the ChoiceMethod tag. This value is used to determine which Choice tag should render its body.

Returns:
the value attribute from a nested Choice tag that matched the return value of the ChoiceMethod.

setChoiceValue

public void setChoiceValue(Object choiceValue)
Set the value on a Choice tag whose value attribute matched the result of the result of invoking the ChoiceMethod.

Parameters:
choiceValue - the result of executing the ChoiceMethod
Beadoc.attributedescription:
The value of a <netui-data:choice> tag whose value attribute matched the result of invoking the <netui-data:choiceMethod> tag.
Beadoc.attributesyntaxvalue:
string_choiceValue
Beadoc.databindable:
false

setRenderedItem

public void setRenderedItem(boolean renderedItem)
A boolean that denotes that an item has been rendered from the set of Choice tags that may be present in the body of a RepeaterItem tag.

Parameters:
renderedItem -

hasRenderedItem

public boolean hasRenderedItem()
Get a boolean that denotes that an item has been rendered for this RepeaterItem. If there are no Choice tags, this will always return false and the body of the RepeaterItem will always render for each item.

Returns:
true if the Choice functionality is being used and a Choice has rendered; false otherwise.

getRenderState

public int getRenderState()
Get the current render state of the RepeaterItem.

Returns:
the RepeaterItem's render state.

registerChildTag

public void registerChildTag(AbstractBaseTag tag)
Register chlid tags that need to be handled specially by the RepeaterItem. This is an internal API method that is used by the Choice, ChoiceMethod, and other tags that need special treatment by the RepeaterItem.

Parameters:
tag - the tag to register.
Exclude:

shouldRender

public boolean shouldRender(Object value,
                            boolean defaultItem)
The decision method that the Choice tags use to determine if the calling Choice tag is the one that hsould render. The rules for deciding if a Choice tag should render are as follows:

Parameters:
value - the Choice.setValue(String) attribute on the Choice tag that is asking if it should render its body.
defaultItem - the Choice.setDefault(boolean) attribute on the Choice tag that is asking if it should render its body.
Returns:
true if the Choice should render; false otherwise.

renderStartTag

public int renderStartTag(int state)
Render the start of this tag. If the repeater render state is Repeater.ITEM, the body is evaluated. Otherwise, the body is skipped.

Specified by:
renderStartTag in class StructuredBaseTag
Returns:
SKIP_BODY unless the repeater render state is Repeater.ITEM, then EVAL_BODY_BUFFERED

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Render the result of having evalutaed the body. Generally, the body is evaluted once, but when ChoiceMethod and Choice tags are present, the body is evaluated twice; once to decide whilch Choice to render and once to actually render the body of that Choice tag.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class RepeaterComponent
Returns:
SKIP_BODY if the item has completed rendering; EVAL_BODY_BUFFERED if the body should render again.
Throws:
javax.servlet.jsp.JspException

localRelease

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

Overrides:
localRelease in class RepeaterComponent

stopRendering

public void stopRendering()

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