您的位置:首页 > Web前端 > JavaScript

jstl使用foreach 循环遍历输出表格和数据

2017-05-15 20:37 218 查看

问题

开发中,如果使用jstl使用foreach循环的时候出现遍历的内容界面乱版,如果不用css 样式控制一下的话可以通过遍历输出表格的方式来控制



办法

<c:forEach items="${bills}" var="item" varStatus="t" step="3">
<tr>
<c:if test="${t.count}%5==0">
<td>
<div class="check-box">
<input name="role" value="${bills[t.index].billId}" type="checkbox" id="box-${t.count}+0" >
<label for="box-${t.count}">${bills[t.index].billNm} </label>
</div>
</td>
</c:if>
<td>
<div class="check-box">
<input name="role" value="${bills[t.index+1].billId}" type="checkbox" id="box-${t.count}+1" >
<label for="box-${t.count}+1">${bills[t.index+1].billNm}</label>
</div>
</td>
<td>
<div class="check-box">
<input name="role" value="${bills[t.index+2].billId}" type="checkbox" id="box-${t.count}+2" >
<label for="box-${t.count}+2">${bills[t.index+2].billNm}</label>
</div>
</td>
</tr>

</c:forEach>


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐