c:forEach 如何输出序号
生活随笔
收集整理的這篇文章主要介紹了
c:forEach 如何输出序号
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
關(guān)鍵在于<c:forEach>的varStatus屬性,具體代碼如下: <table width="500" border="0" cellspacing="0" cellpadding="0">
<tr> <th>序號(hào)</th> <th>姓名</th>
</tr>
<c:forEach var="student" items="${ students}" varStatus="status">
<tr> <td>${ status.index + 1}</td> <td>${ student.name}</td>
</tr>
</c:forEach>
</table>
?
備注:status.index是從0開始的。status.count是從1開始的。
?
轉(zhuǎn)載于:https://www.cnblogs.com/qlqwjy/p/7475393.html
總結(jié)
以上是生活随笔為你收集整理的c:forEach 如何输出序号的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java反射机制概念及应用场景
- 下一篇: 计算机教室的教师端,极域电子教室教师端使