您现在的位置是:首页>技术分享>c:forEach 如何输出序号
c:forEach 如何输出序号
发布时间:2017-08-11 编辑:小付 浏览(661) 评论(0)
<table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <th>序号</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开始的。
关键字词:jsp,foreach,序号,size,index