The goal of this maintenance release is to align the JSTL specification with the work done on the JavaServer Pages 2.1 and JavaServer Faces (Faces) 1.2 specifications. Also, as of this release (JSTL 1.2), JSTL is now part of the Java Enterprise Edition platform.
The semantics of the standard actions <c:forEach> and <c:forTokens> are modified to allow the iteration tags to work seamlessly with nested JavaServer Faces actions.
More specifically, <c:forEach> and <c:forTokens> now support nested actions with deferred-values referring to the iteration variable, as long as a deferred value has been specified for the 'items' attribute.
For example:
Changes:
<c:forEach var="item" items="#{model.list}">
<h:inputText value="#{item.name}"/>
</c:forEach>
doStartTag()
...
// 'items' is a deferred-value
// Get the current EL VariableMapper
VariableMapper vm = jspContext.getELContext().getVariableMapper();
// Create an expression to be assigned to the variable specified
// in the 'var' attribute.
// 'index' is an iteration counter kept by the tag handler.
myimpl.IndexedExpression expr = new myimpl.IndexExpression(getItems(), index);
// Assign the expression to the variable specified in the 'var' attribute,
// so any reference to that variable will be replaced by the expression
// in subsequent EL evaluations.
oldMapping = vm.setVariable(getVar(), expr);
...
doEndTag()
...
// restore the original state of the VariableMapper:
jspContext.getELContext().getVariableMapper().setVariable(getVar(), oldMapping);
...
The number of items referred to by the "items" attribute must be the same when JSF creates the component tree and when JSP executes the iteration tag. Undefined behavior will result if this is not the case.
The semantics of the standard action <c:set> have been modified to allow the action to accept a deferred-value.
For example:
<c:set var="d" value="#{handler.everythingDisabled}"/>
...
<h:inputText id="i1" disabled="#{d}"/>
<h:inputText id="i2" disabled="#{d}"/>
Changes:
doStartTag()
...
// 'value' is a deferred-value
// Get the current EL VariableMapper
VariableMapper vm = jspContext.getELContext().getVariableMapper();
// Assign the expression to the variable specified in the 'var' attribute,
// so any reference to that variable will be replaced by the expression
// in subsequent EL evaluations.
vm.setVariable(getVar(), (ValueExpression)getValue());
...