Re: JSTL Confusion with <c:set>
On Apr 15, 12:58 pm, johnpcam...@gmail.com wrote:
I have a small loop, and I'm trying to figure out how to increment a
counter in a specific way.
<c:set var="formCount" value="0"/>
<c:forEach begin="1" end="3" var="count">
<tag:collectorCompare name="form${count}HeaderOut" valu=
e=""
trim="yes">
<tag:collectorNotEqual>
<c:set var="formCount" =
value="${count}"/>
</tag:collectorNotEqual>
</tag:collectorCompare>
</c:forEach>
The 'collector' stuff is from a company internal taglib. But my
question relates to the formCount variable. For some reason, even when
the value equals "" (internally it is doing .equals, not ==), it's
setting the formCount variable during every iteration.
Does <c:set> get called no matter what the condition around it? Is
there another construct I should be using? Every time I move through
the forEach loop, it sets the formCount whether the condition fails or
not.
That depends on the definition of tag:collectorNotEqual, which we
cannot see so cannot tell.
--
Lew