I am writing code like this in a JSPX file,
<table>
<c:forEach var="var" items="${items}" varStatus="status">
<c:if test="${(status.index) % 4 == 0}">
<tr>
</c:if>
<td>some contents</td>
<c:if test="${(status.index+1) % 4 == 0 || status.last}">
</tr>
</c:if>
</c:forEach>
</table>
The problem is, the <tr> and </tr> will cause compilation errors in JSPX. It will say “<tr> should be ended with a </tr>“. However, it is fine with JSP.
Is there any way to do things like this in JSPX? Thank you!
I guess you could do the following: