Random taglib ver. 1.7


    Custom JSP tags library. Tag randomValue calculates an integer random value within the given interval. Two parameters are integer values describe interval. You may use this tag in two forms:

1) just prints the random value
 

<%@ taglib uri="taglib.tld" prefix="rand" %>
<html>
<p><i> Random value within the interval [1,10]:</i> <rand:randomValue from="1" to="10"/>
</html>

2) prints nothing, but creates a variable (type is java.lang.Integer) initialized by the random value from the given interval. You may use this variable later in your scriptlets:
 

<%@ taglib uri="taglib.tld" prefix="rand" %>
<html>
<rand:randomValue from="5" to="9" id="var_name"/>
<br>Random is  <%=var_name.intValue()%>
<%
    int val=var_name.intValue();
    ....
%>
</html>

Parameter id describes a name for this variable. E.g. in the above mentioned example this name is var_name.

Tag randomSequence calculates an sequence of random numbers within the given interval. Tag also creates a page (session, application) scope variable (type is java.util.ArrayList) for the calculated values.

Tags are:

randomValue

Calculates random value from the given interval. Parameters are:

1) from describes a minimal value
2) to describes a maximal value
3) id Optional parameter describes a variable for data (type is java.lang.Integer). Without this parameter tag just prints data.
4) scope Optional parameter. Describes a scope for the variable (see parameter id). Possible values are page, request, session or application. Default value is page.

randomSequence

Calculates a sequence of random values from the given interval. Parameters are:

1) from describes a minimal value
2) to describes a maximal value
3) size Describes a size for your sequence
4) id Optional parameter describes a variable for data (type is java.util.ArrayList). Without this parameter tag just prints data.
5) scope Optional parameter. Describes a scope for the variable (see parameter id). Possible values are page, request, session or application. Default value is page.
6) unique Optional parameter. Describes a boolean value. If this value is true than all the calculated values must be unique. Default value is false.

for downloading:

 Library: random.jar     Description: taglib.tld

 © Coldbeans      Comments?

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

Also in Coldtags: