Repeater Class
- 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:
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 |
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
defaultText | No | No | No |
The text that is rendered if the data set is null or contains zero items. |
ignoreNulls | No | No | No |
A boolean to set if rendering a sparse data set that can contain nulls which should be ignored. |
Related Topics
<netui-data:repeater> Tag Sample
Presenting Complex Data Sets in JSPs (Repeater Tags section)
RepeaterHeader
RepeaterItem
RepeaterFooter
-
Hierarchy
-
Object
TagSupport
BodyTagSupport
AbstractBaseTag
DataSourceTag
Repeater
-
All Implemented Interfaces
-
BodyTag
, DataAccessProvider
, IterationTag
, Serializable
, Tag
public static final int |
-
END
- A Repeater rendering state that signals the end of repeater rendering.
|
public static final int |
-
FOOTER
- A Repeater rendering state that signals the rendering of the FOOTER.
|
public static final int |
-
HEADER
- A Repeater rendering state that signals the rendering of the HEADER.
|
public static final int |
-
INIT
- A Repeater rendering state that signals the beginning of repeater rendering.
|
public static final int |
-
ITEM
- A Repeater rendering state that signals the rendering of the ITEM.
|
Fields from com.bea.wlw.netui.tags.AbstractBaseTag |
ATTR_GENERAL , ATTR_GENERAL_EXPRESSION , ATTR_JAVASCRIPT , ATTR_STYLE , CLASS , ID , JAVASCRIPT_STATUS , NAME , NETUI_UNIQUE_CNT , ONCLICK , ONDBLCLICK , ONKEYDOWN , ONKEYPRESS , ONKEYUP , ONMOUSEDOWN , ONMOUSEMOVE , ONMOUSEOUT , ONMOUSEOVER , ONMOUSEUP , STYLE , TABINDEX
|
Methods from com.bea.wlw.netui.tags.AbstractBaseTag |
addTagIdMapping , evaluateAttributeToString , filter , filter , getJavaScriptUtils , getNearestForm , getScriptReporter , getUserLocale , localRelease , registerTagError , release , renderAttribute , rewriteName , write
|
Methods from javax.servlet.jsp.tagext.TagSupport |
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
END
public static final int END
- A Repeater rendering state that signals the end of repeater rendering.
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.
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.
INIT
public static final int INIT
- A Repeater rendering state that signals the beginning of repeater rendering.
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.
Repeater
public Repeater()
addContent(String) Method
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.
doAfterBody() Method
public int doAfterBody()
-
Overrides
-
BodyTagSupport.doAfterBody()
Returns
- SKIP_BODY if an error occurs or the data set has been rendered; EVAL_BODY_AGAIN otherwise
doEndTag() Method
public int doEndTag()
throws JspException
-
Overrides
-
BodyTagSupport.doEndTag()
Returns
- EVAL_PAGE
Exceptions
-
JspException
- if an error occurs that can not be reported in the page
doStartTag() Method
public int doStartTag()
throws JspException
-
Overrides
-
BodyTagSupport.doStartTag()
Returns
- SKIP_BODY if an error occurs; EVAL_BODY_BUFFERED otherwise
Exceptions
-
JspException
- if an error occurs that can not be reported in the page
getCurrentIndex() Method
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.
Returns
- the integer index of the current data item in the data set
Related Topics
DataAccessProvider
getCurrentItem() Method
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.
Returns
- the current item in the data set
Related Topics
DataAccessProvider
getCurrentMetadata() Method
public Object
getCurrentMetadata()
Get the metadata for the current item. This method is not supported by
this tag.
Returns
- the current metadata or
null
if no metadata can be
found or metadata is not supported by a DataAccessProvider implementation
Related Topics
DataAccessProvider
getDefaultText() Method
public String
getDefaultText()
Get the defaultText attribute.
Returns
- the default text or
null
if unset.
getIgnoreNulls() Method
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
getProviderParent() Method
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
Returns
- a containing DataAccessProvider if one exists, null otherwise.
Related Topics
DataAccessProvider
getRenderState() Method
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
Repeater.INIT
, Repeater.HEADER
, Repeater.ITEM
,Repeater.FOOTER
, or Repeater.END
.
getTagName() Method
public String
getTagName()
Get the name of this tag. This is used to identify the type of this tag
for reporting tag errors.
-
Overrides
-
AbstractBaseTag.getTagName()
Returns
- a constant String representing the name of this tag.
localRelease() Method
protected void localRelease()
Reset all of the fields of this tag.
-
Overrides
-
DataSourceTag.localRelease()
registerChildTag(RepeaterComponent) Method
public void registerChildTag(RepeaterComponent
repeaterComponent)
Parameters
-
repeaterComponent
-
RepeaterComponent
to register with the Repeater parent
setDefaultText(String) Method
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
setIgnoreNulls(boolean) Method
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
setPadContext(PadContext) Method
public void setPadContext(PadContext
padContext)