Taglib provides a support for the very often used
operations: getting the first (the last or the random) element from the given collection.
For example:
<%@ taglib uri="taglib.tld" prefix="f" %> <% java.util.Vector v=new java.util.Vector(); v.addElement("1"); v.addElement("2"); %> first: <f:getFirst source="<%=v%>"/> last: <f:getLast source="<%=v%>" id="A" /> <%=A%> You can directly provide your collection for the tag or pass a name for your bean in a page (request, session or application) scope. Tags are: getFirst Tag requests the first element from the given collection. Parameters are: 1) source Optional parameter. Describes a collection, iterator, enumeration or array
getLast Tag requests the last element from the given collection. Parameters are: 1) source Optional parameter. Describes a collection, iterator, enumeration or array
getRandom Tag requests the random element from the given collection. Parameters are: 1) source Optional parameter. Describes a collection, iterator, enumeration or array
getSize Tag calculates the size for the given collection. Parameters are: 1) source Optional parameter. Describes a collection, iterator, enumeration or array
for downloading: Library: firsttag.jar Description: taglib.tld See also Coldtags suite - the largest collection of custom JSP tags.
|
Also in Coldtags:
|