Nika Gudge
asked on
Iteration loop counter in JSTL tag
<table class="TableBackgroundDB">
<thead>
<tr class="TableHeaderRow">
<th>Name</th>
<th>Specification</th>
</tr>
</thead>
<c:forEach var="product" items="${res.product}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" value="odd" />
</c:when>
<c:otherwise>
<c:set var="rowStyle" value="even" />
</c:otherwise>
</c:choose>
<portlet:renderURL var="searchProductURL">
<portlet:param name="action" value="viewProduct" />
<portlet:param name="spec" value="${product.Specifica tion}" />
</portlet:renderURL>
<tr class="${rowStyle}">
<td><a href="${searchProductURL}" >${product .name}</a> <td>
<td>${product.Specificatio n}</td>
</tr>
</c:forEach>
</table>
</c:if>
output-
Name Specification
product product.ss1
<thead>
<tr class="TableHeaderRow">
<th>Name</th>
<th>Specification</th>
</tr>
</thead>
<c:forEach var="product" items="${res.product}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" value="odd" />
</c:when>
<c:otherwise>
<c:set var="rowStyle" value="even" />
</c:otherwise>
</c:choose>
<portlet:renderURL var="searchProductURL">
<portlet:param name="action" value="viewProduct" />
<portlet:param name="spec" value="${product.Specifica
</portlet:renderURL>
<tr class="${rowStyle}">
<td><a href="${searchProductURL}"
<td>${product.Specificatio
</tr>
</c:forEach>
</table>
</c:if>
output-
Name Specification
product product.ss1
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
one product object in res.product. i'm trying to display properties of this object.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
solved
ASKER