当我们查询出数据时,要在页面上输出,而且是用的<c:forEach></c:forEach>循环的,那么可以在标签里面设一个属性varStatu,这样就可以得到很整齐的格式了,而且还是按一定数量排列的。。如下:
<table>
<tr>
<c:forEach items="${types}" var="type" varStatus="loop">
<td>
<c:if test="${fn:length(type.childtypes)>0}">
<a href='<html:rewrite action="/control/product/manage" />?method=selectUI&typeid=${type.typeid}'>${type.name}</a>
</c:if>
<c:if test="${fn:length(type.childtypes)==0}">
<input type="radio" name="type" οnclick="javascript:getDicName('${type.typeid}','${type.name}')">${type.name}
</c:if>
</td>
<c:if test="${loop.count%5==0}"></tr><tr></c:if>
</c:forEach>
</tr>
</table>
这里是按每一行5个数据排列的,所以是loop.count%5==0,后面就是</tr>换行了。