The beans tag operates on a collection of the specified bean objects and iterates through that collection.
JSP
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.
This tag has the following attributes for which the Required values are “Yes” and “No”:
Name of the bean collection to create.
Name of the bean collection to use.
A boolean that selects iteration. Default is "false", the collection will not iterate.
Type of the bean; a java class name.
Number of beans to create for the collection.
During iteration, specifies a name by which the current bean may be retrieved from the PageContext.
This tag provides the following bean properties for which the Type values are “Integer”, “Boolean” and the Access value is “Get/Set”:
Index of the current bean in the collection.
The number of iterations the collection should perform.
The zero based index from which to begin iteration.
The zero based index that denotes the item upon which iteration will terminate.
One-based start; suitable for presentation.
One-based end; suitable for presentation.
The size of the collection being paged.
Whether or not there are more items in the collection, beyond the current iterations.
Whether there are items in the collection preceding the current iterations.
<%-- 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>