list传值,每4列换行显示,代码如下:
<div id="orgsDiv">
<c:set var="j" value="0" />
<c:set var="type" value="" />
<c:forEach items="${orgs}" var="org" varStatus="i">
<c:if test="${type != org.type && i.index!=0}">
// forEach 补列
<c:forEach begin="${j%4}" end="3">
<td width="25%"> </td>
</c:forEach>
</tr>
</table>
<hr width="100%" style="border: 1px solid #cadae8; height: 1px">
</c:if>
<c:if test="${type != org.type }">
<c:set var="j" value="0" />
<table border="0" width="100%" cellpadding="0" cellspacing="0">
</c:if>
<c:if test="${j%4 == 0}">
<tr>
</c:if>
<td width="25%">
<html:multibox property="orgIds">${org.id}</html:multibox>
<c:out value="${org.shortName}" />
</td>
<c:if test="${(i.last) || (j%4 == 3)}">
<c:if test="${i.last}">
<c:forEach begin="${i.index%4}" end="2">
<td width="25%"> </td>
</c:forEach>
</c:if>
</tr>
<c:if test="${i.last}">
</table>
</c:if>
</c:if>
<c:set var="j" value="${j+1}" />
<c:set var="type" value="${org.type}" />
</c:forEach>
</div>