网上看到这个问题其中使用了:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"prefix="fn"%>
用其length属性可以获得集合数量:${fn:length(list)} (fn后面是冒号)其中的list就是<c:forEach>标签中items属性的值
试了一下:直接用集合的size方法也行。<c:forEach items="${roleList}" var="role" varStatus="status">
<c:if test="${status.index % 3 == 0 }"><tr>
</c:if>
<td align="left">[<a href='editRole.do?RoleID=${role.roleID }'>${role.roleName }</a>]<br /></td>
<c:if test="${(status.index+1) % 3 == 0 }">
</tr>
</c:if>
<c:if test="${status.count == roleList.size() }">
</tr>
</c:if>
</c:forEach>