1 //两列的 2 <c:forEach var="bean" items="${result}" varStatus="status"> 3 <c:if test="${status.count%2==1}"> 4 <tr> 5 </c:if> 6 <td><b>$...{bean.id}</b>:$...{bean.name}</td> 7 <c:if test="${status.count%2==0}"> 8 </tr> 9 </c:if> 10 <c:set var ="v_count" value="${status.count}"/> 11 </c:forEach> 12 <c:if test="${v_count%2==1}"> 13 <td></td> 14 </tr> 15 </c:if>
1 //三列的 2 <c:forEach var="bean" items="${result}" varStatus="status"> 3 <c:if test="${status.count%3==1}"> 4 <tr> 5 </c:if> 6 <td><b>$...{bean.id}</b>:$...{bean.name}</td> 7 <c:if test="${status.count%3==0}"> 8 </tr> 9 </c:if> 10 <c:set var ="v_count" value="${status.count}"/> 11 </c:forEach> 12 <c:if test="${v_count%3==1}"> 13 <td></td> 14 <td></td> 15 </tr> 16 </c:if> 17 <c:if test="${v_count%3==2}"> 18 <td></td> 19 </tr> 20 </c:if>