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

来源:互联网 发布:罗马2 兵种数据修改 编辑:程序博客网 时间:2024/05/18 21:41

问题

开发中,如果使用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>

这里写图片描述

原创粉丝点击