<table border="1" width="80%">
<tr>
<c:forEach var="i" items="${requestScope.list}">
<td width="25%">${i.id}</td>
<c:if test="${i.id%4==0}">
</tr>
</c:if>
</c:forEach>
</tr>
</table>我从数据库中取出ID号存在request中,然后取出来,我要每行4个后换个行,那我是用${i.id%4==0}
我数据库中id是自动增长的,如果我不用id的话要如何来判断换行谢谢大家。。额。。
<tr>
<c:forEach var="i" items="${requestScope.list}">
<td width="25%">${i.id}</td>
<c:if test="${i.id%4==0}">
</tr>
</c:if>
</c:forEach>
</tr>
</table>我从数据库中取出ID号存在request中,然后取出来,我要每行4个后换个行,那我是用${i.id%4==0}
我数据库中id是自动增长的,如果我不用id的话要如何来判断换行谢谢大家。。额。。
<%
List list = request.getAttribute("list"); int size = list.size(); for(int i = 0; i < size; i++){
if(i % 4 == 0){
//进行换行操作
%>
<%
}
}
%>
<c:foreach var="i" items="${requestScope.list}" varStatus="status">
<c:if test="${status.count%4==0}">
</c:if> </foreach>
加上这个属性,然后,就可以在中间使用${status.count}这个就是从1开始计算你的记录的
你判断这个是否被4整除就OK了这样就搞定哒