jsp c:forEach 每次循环打连接的三上数

来源:百度知道 编辑:UC知道 时间:2024/06/17 18:37:52
<c:forEach items="${topic.smalltypepo}" var="smallType" step="2">
${smallType[0].name}
${smallType[1].name}
${smallType[2].name}
</c:forEach>

我想每一次循环就取出连接的三个值,怎么做,上面这样不行
我每一行会是连接的三个值,但我不知道怎么取,forEach难道只能每循环一次取一个值出来??

为什么step="2",难道是隔一个显示一个?

<c:forEach items="${topic.smalltypepo}" var="smallType" step="2">
  ${smallType.name}
  ${smallType.name}
  ${smallType.name}
</c:forEach>

<c:forEach items="${topic.smalltypepo}" var="smallType" begin="0" step="1" varStatus="status" >
<c:if test="${status.index%3==0}"> <tr></c:if>
<td>${smallType.name}</td>
<c:if test="${status.index%3==2}"> </tr></c:if>
</c:forEach>