結(jié)合struts的iterate tag+JSTL1.1實(shí)現(xiàn)多列列表的顯示。下面一段示例代碼中顯示的是2列,如果想顯示多列,則直接把2改成自己想顯示的列數(shù)即可。
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
1 <nested:iterate property="items" indexId="index">
2 <c:if test="${index%2==0}">
3 <tr>
4 </c:if>
5 <td>
6 ${index}
7 </td>
8 <c:if test="${(index+1)%2==0}">
9 </tr>
10 </c:if>
11
12 </nested:iterate>