Search code examples
htmlstruts-1

Attribute Value <c:choose> not closed


I'm working in a JSP dealing with a table row and don't understand why Spring Tools Suite would throw this error at me. It tells me Attribute value c:choose is not closed, but here is the code.

<tr class=
<c:choose>
<c:when test="${status.count % 2 == 0}">"evenRow"</c:when>
<c:otherwise>""</c:otherwise>
</c:choose>>
<td style="width:210px;"><c:out value="${group.name}"/></td>
<td style="width:70px;"><c:out value="${group.memberNumber}"/></td>
<td style="width:180px;"><c:out value="${group.groupType}"/></td>
<td style="width:70px;"><c:out value="${group.currentDiscount}"/></td>
</tr>

As you can see I'm attempting to vary the class name depending if the row is even or not, but it doesn't seem to like the way I have it set up.

Thanks in advance!


Solution

  • There is a more simple way:

    <tr class="${status.count % 2 == 0 ? 'evenRow' : ''}">