一直不太清楚varStatus中index 和count的用法,尤其是下边一段代码:
status.index与count的输出结果是一样的。
查看了下源代码发现:
原来index的值是迭代的索引值+begin的。。
- <c:forEach var ="i" begin="1" end ="20" varStatus="status">
- ${i } ${status.index }<br>
- </c:forEach>
<c:forEach var ="i" begin="1" end ="20" varStatus="status">
${i } ${status.index }<br>
</c:forEach>
status.index与count的输出结果是一样的。
查看了下源代码发现:
- public int getIndex() {
- return (index + begin);
- // our 'index' isn't getIndex()
- }
- public int getCount() {
- return (count);
- }
public int getIndex() {
return (index + begin);
// our 'index' isn't getIndex()
}
public int getCount() {
return (count);
}
原来index的值是迭代的索引值+begin的。。