日期:2014-05-17  浏览次数:20846 次

c标签问题
<c:forEach begin="1" end="11" step="i" >
${i}
</c:forEach>


为什么会报错 i 类型错误!刚开始接触C标签,小白一枚
------解决方案--------------------
是这么用的:
<c:forEach items="${list}" var="item" [begin="beginIndex" end="endIndex" step="step"]>
${item}
<c:forEach>

begin、end、step都是索引值,可以不设置值。
真正循环的是前面的items。

------解决方案--------------------
哥们,给你举个例子:
<%
 String arr[] = new String[11];
 request.setAttritue("arr",arr);
%>
<c:forEach items="${arr}" var="item" varStatus="s">
${s.count}
</c:forEach>
------解决方案--------------------
用forEach的话,items必填