Advanced Customization > Info*Engine User’s Guide > Info*Engine Custom Tag Reference > Info*Engine Tags > Supplied Library Tags (JSTL)
  
Supplied Library Tags (JSTL)
This tag library provides basic JSTL-like functionality for Info*Engine tasks. This includes the ability to set variables, iterate over lists and use conditional logic.
These tags are included in the /com/infoengine/tlds/iejstl.tld tag library. To use these tags, you must include a taglib directive in your task similar to the following:
<%@ taglib uri="/com/infoengine/tlds/iejstl.tld"
prefix="c" %>
The syntax for these tags assumes that you have specified the c prefix in the taglib directive. If you specify a different prefix, use the prefix you specified in place of c in the tag syntax.
choose
This tag allows for conditional evaluation with an alternative for evaluation failure (if/else). It requires embedded children for when/otherwise evaluations.
Syntax
<c:choose>
<c:when test="CONDITION">
<!-- processed when CONDITION evaluates to true -->
</c:when>
<c:otherwise>
<!-- processed when CONDITION evaluates to false -->
</c:otherwise>
</c:choose>
Example
<c:choose>
<c:when test="${group == null || group.elementCount==0}">
<!-- do when group named "group" is empty -->
</c:when>
<c:otherwise>
<!-- do when group contains elements -->
</c:otherwise>
</c:choose>
forEach
This tag supports iteration over an iterable, group, or array of objects.
Syntax
<c:forEach var="VARIABLE" var="LIST">
<!-- invoked once for each element in LIST -->
</c:forEach>
Attribute Descriptions
Required attributes: list and var.
list
The list to iterate over. This must evaluate to an iterable, group, or array.
This attribute is required, and is also an expression.
var
The variable name to use for individual list elements during iteration. The value of var specifies the name of an implicit variable that is defined (and which must be unique within its scope within your task). In addition, a tasklet context variable is set with this name for each iteration so that it can be reused within other expressions. If the list being iterated over is an Info*Engine group, then the context variable is an Info*Engine element.
In addition to setting the variable, an element group named with the var attribute value is placed in the VDB (similar to the forEach tag functionality supplied with the Info*Engine core tag library).
Multi-valued attributes can also be iterated over using an expression such as ${myGroup[0]att[*]}. This attribute is required.
Example
<c:forEach var="one" list="${output}">
<log:info message="attribute A has a value of ${one[0]A[0]}" />
</c:forEach>
if
The if tag allows for conditional evaluation of its body.
Syntax
<c:if test="CONDITIONAL">
<!-- invoked if CONDITIONAL evaluates to true -->
</c:if>
Attribute Descriptions
Required attributes: test
test
Contains the conditional statement to be evaluated. The test attribute supports operators [==, !=, <, >, <=, and >=]. The numeric operators require that the operands be of a numeric data type for comparison. Where possible, if the operands are of different data types an attempt is made to coerce one to the other to attempt comparison. If one of the operands is a constant, then an attempt is made to coerce the variable to the constant. Conditional expressions of arbitrary complexity can be specified. Portions of expressions to be evaluated together must be grouped with ( ) and expressions can then be joined by [||, &&].
This attribute is required and is also an expression.
* 
&& must be encoded as ‘&amp;&amp,’.
Example
<c:if test="${@FORM[]bool[]==true}">
<!-- conditional code -->
</c:if>

<c:if test="${this==that || (this!=that&amp;&amp;a<b)}">
<!-- conditional code -->
</c:if>
otherwise
This tag is related to the choose and when tags. It must be a child of the choose tag, and have a sibling when tag. If the when tag evaluates to false, then the content of the otherwise tag is invoked and executed (represents the “else” of if/else logic).
Syntax
<c:choose>
<c:when test="CONDITION">
<!-- processed when CONDITION evaluates to true -->
</c:when>
<c:otherwise>
<!-- processed when CONDITION evaluates to false -->
</c:otherwise>
</c:choose>
Example
<c:choose>
<c:when test="${group == null || group.elementCount==0}">
<!-- do when group named "group" is empty -->
</c:when>
<c:otherwise>
<!-- do when group contains elements -->
</c:otherwise>
</c:choose>
return
Terminates task invocation.
Syntax
<c:return/>
Example
<c:if test="${input == null}">
<c:return />
</c:if>
set
The set tag sets a variable in either the tasklet context or request context.
Syntax
<set var="VARIABLE" value="VALUE"/>
Attribute Descriptions
Required attributes: var and value.
var
The variable to set.
This attribute is required.
value
The value to set. The value attribute supports more complex expressions representing mathematical operations on two operands of the same type. The supported operands are [+, -, *, /, %, &, |]. Within a task the ‘&’ operator must be escaped like ‘&amp;’.
This attribute is required and can also be an expression.
* 
Where one operand is a constant and the other a variable, if required and possible the variable is coerced to the data type of the constant. Supported data types for mathematical operations are int and float.
requestScope
Boolean specifying whether the variable should be task or request scope. The default is set to false.
Example
<c:set var="onePlusOne" value="${one+1}"/>
when
Similar to if, but within a choose parent tag (represents the “if” of if/else logic). Provides JSTL support for Info*Engine tasks.
Syntax
<c:choose>
<c:when test="CONDITION">
<!-- processed when CONDITION evaluates to true -->
</c:when>
<c:otherwise>
<!-- processed when CONDITION evaluates to false -->
</c:otherwise>
</c:choose>
Attribute Descriptions
Required attribute: test.
test
Contains the conditional statement to be evaluated. The test attribute supports operators [==, !=, <, >, <=, and >=]. The numeric operators require that the operands be of a numeric data type for comparison. Where possible, if the operands are of different data types then an attempt is made to coerce one to the other to attempt comparison. If one of the operands is a constant, then an attempt is made to coerce the variable to the constant. Conditional expressions of arbitrary complexity can be specified. Portions of expressions to be evaluated together must be grouped with ( ) and expressions can then be joined by [||, &&].
* 
&& must be encoded as ‘&amp;&amp;’.
This attribute is required and is also an expression.
Example
<c:choose>
<c:when test="${group == null || group.elementCount==0}">
<!-- do when group named "group" is empty -->
</c:when>
<c:otherwise>
<!-- do when group contains elements -->
</c:otherwise>
</c:choose>