Random iterate taglib ver. 1.3


    Custom JSP tag. Lets you iterate execution over the random subset of collections, iterators, enumerations or arrays. For example:
 


<%@ taglib uri="taglib.tld" prefix="loop" %>

<%
  java.util.Vector v=new java.util.Vector();
  v.addElement("first");
  v.addElement("second");
 ...
%>

<loop:randomIterate source="<%=v%>" id="A" count="5">
   <br>Element: <%=A%>
</loop:randomIterate>

Here tag executes own body for the 5 random elements from the source.

Also you can provide a name for the attribute in page (request, session, application) scope that will be used as a source data for the iteration.

Tags are:

randomIterate

Iterates over the given source. Parameters are:

1) source Optional parameter. Describes a collection, iterator, enumeration or array
2) name Optional parameter. Describes an attribute in page (request, session, application) scope that keeps collection, iterator, enumeration or array.
3) id Optional parameter. Describes a page scope variable (default type is java.lang.Object) you may use in the body as a reference to the current element.
4) index Optional parameter. Describes a page scope variable (type is java.lang.Integer) you may use in the body as a reference to the current index.
5) type Optional parameter. Describes a type for page scope variable. Default value is java.lang.Object.
6) count Describes a size for the random sequence (how many steps)

for downloading:

Library: randomizetag.jar     Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: