beans
|
Description |
The beans tag operates on a collection of the specified
bean objects and iterates through that collection. |
Tag Body |
JSP |
Restrictions |
If the id attribute is specified then a collection of type
and size is created. If the name attribute is specified then
the collection is restored from the page context. The type attribute
specifies the java class name of the object to create for the collection.
|
Attributes |
This tag has the following attributes:
Attribute |
Description |
Req'd? |
id |
Name of the bean collection to create. |
No |
name |
Name of the bean collection to use. |
No |
iterate |
A boolean that selects iteration. Default is "false", the collection
will not iterate. |
No |
type |
Type of the bean; a java class name. |
No |
size |
Number of beans to create for the collection. |
Yes |
beanid
|
During iteration, specifies a name by which
the current bean may be retrieved from the PageContext.
|
No
|
|
Properties |
This tag provides the following bean properties:
Property |
Description |
Type
|
Access |
index |
Index of the current bean in the collection. |
Integer
|
Get |
count |
The number of iterations the collection should perform. |
Integer
|
Get/Set |
start |
The zero based index from which to begin iteration. |
Integer
|
Get/Set |
end |
The zero based index that denotes the item upon which iteration will
terminate. |
Integer
|
Get |
startOne |
One-based start; suitable for presentation. |
Integer
|
Get |
endOne |
One-based end; suitable for presentation. |
Integer
|
|
size |
The size of the collection being paged. |
Integer
|
Get |
nextPage |
Whether or not there are more items in the collection, beyond the current
iterations. |
Boolean
|
Get |
prevPage |
Whether there are items in the collection preceding the current iterations.
|
Boolean
|
Get |
|
Example(s) |
<%-- create a list of 5 dates and set the seconds to the index --%> <util:beans id="dates" size="5" type="java.util.Date" iterate="true">
<util:get property="index" id="index"/>
<util:bean>
<util:set property="seconds" id="index"/>
</util:bean>
</util:beans>
<%-- iterate through the dates collection --%>
<util:beans name="dates" iterate="true"/>
<util:bean>
date = <util:get/>
</util:bean>
</util:beans>
|