below is my code piece.
<c:forEach var="attribute" items="${compareAttributes}" varStatus="item">
<c:if test="${attribute.displayName != 'Price'}">
<tr class="<c:if test="${
item.count % 2 == 1}">even</c:if>">
<th class="attribute dotted-right"><strong>${mn:htmlFormat(attribute.displayName)}</strong></th>
<td> something </td>
</tr>
</c:if>
</c:forEach>
I am printing the rows in Zebrastips, for that i am doing ' if item.count%2==1' then apply cssClass ' even'.
But i am skipping one row from the retrieved list. It is in row 5. so my 4th and 6th rows come one after the other(5th row is skipped).here when i use 'item.count%2' , since 4th and 6th rows are even i am getting those two rows in same background color. to get rid of this i am trying to declare a variable on which i can do increment operation and use it in place of item.count.
I tried <c:set var="evenCount" value="${0}" /> (as replied in the above
thread) and then <c:if test="${evenCount++ % 2 == 1}">
But this did not help me.
What i did was :
<c:set var="evenCount" value="${0}" />
<c:forEach blah blah.....>
<c:set var="evenCount" value="${evenCount+1}" /> and then <c:if test="${evenCount % 2 == 1}">
-----
---
</c:forEach>
is working fine.
Now my question is , how can i make use of increment/decrement (++,--) operators in EL?