<c:forEach items="${datas}" var="item">
<c:forEach items="${item}" var="entry">
${entry.value}<br/>
</c:forEach>
</c:forEach>
怎么做一个三列的表格行是未知的
主要是告诉我这个实现的语法 我对这个有点陌生。要代码也要解释
先谢谢了
<c:forEach items="${item}" var="entry">
${entry.value}<br/>
</c:forEach>
</c:forEach>
怎么做一个三列的表格行是未知的
主要是告诉我这个实现的语法 我对这个有点陌生。要代码也要解释
先谢谢了
<table>
<c:forEach items="${datas}" var="item">
<c:forEach items="${item}" var="entry">
<tr><td>${entry.value1}</td><td>${entry.value2}</td><td>${entry.value3}</td></tr>
</c:forEach> </c:forEach> </table>
<c:if test='${status.count%3 eq 0}'>//对3求余,status.count表示当前 状态索引
<tr>
</c:if>
<td>${entry.value} <br/> </td>
<c:if test='${status.count%3 eq 2}'>//对3求余
</tr>
</c:if>
</c:forEach>
放到request范围中,直接遍历就行了。
<table>
<tr><th>xxx</th><th>xxx</th></tr>
<c:forEach items="${存放在范围中的名字}" var="item">
<tr><td>${item.xxx}</td><td>${item.xxx}</td></tr>
</c:forEach>
</table>
datas是个什么东西,是不是map对象
map无限制 这么说清楚了吗?
我这个datas = list<map<key values>>
<c:forEach items="${item}" var="entry" varStatus="status">
<c:if test='${status.count%3 eq 0}'>//对3求余,status.count表示当前 状态索引
<tr>
</c:if>
<td>${entry.value} <br/> </td>
<c:if test='${status.count%3 eq 2}'>//对3求余
</tr>
</c:if>
</c:forEach>
</c:forEach>
估计是循环错误
能不能给我讲讲if里面的test=?这是什么
status.count又是什么?
<c:if test='${status.count%3 eq 2}'>//对3求余
</tr>
</c:if>
会提示
</tr>
没有起始标签
<c:if test='${status.count%3 eq 0}'>这个有点像
for(int i=0;i<n;i++)
{
if(i%3==0)
{ }}
。
是可以运行哦
是可以运行哦
<c:forEach items="${datas}" var="item">
<c:forEach items="${item}" var="entry">
<tr><td>${entry.value1}</td><td>${entry.value2}</td><td>${entry.value3}</td></tr>
</c:forEach> </c:forEach> </table>
<c:forEach items="${datas}" var="item">
<c:forEach items="${item}" var="entry" varStatus="status">
<c:if test='${status.count%3 eq 0}'>//对3求余,status.count表示当前 状态索引
<tr>
</c:if>
<td>${entry.value} <br/> </td>
<c:if test='${status.count%3 eq 2}'>//对3求余
</tr>
</c:if>
</c:forEach>
</c:forEach>
</table>你不会连table也没有加上吧,没有加上的话就没有表格效果了
<c:forEach items="${datas}" var="item">
<tr>
<c:forEach begin="1" step="1" end="3">
<td>
${entry.value} <br/>
</td>
</c:forEach>
</tr>
</c:forEach>
</table>
这两个应该可以的
<c:forEach items="${datas}" var="item">
<c:forEach items="${item}" var="entry" varStatus="status">
<c:if test='${status.index%3 eq 0}'>//对3求余,status.count表示当前 状态索引
<tr>
</c:if>
<td>${entry.value} <br/> </td>
<c:if test='${status.index%3 eq 2}'>//对3求余 count根本不是索引
</tr>
</c:if>
</c:forEach>
</c:forEach>
</table>