[JSP] c:forEach 输出序号判断奇偶数作不同处理
来源:互联网 发布:淘宝网店店主 编辑:程序博客网 时间:2024/06/05 05:05
关键在于<c:forEach>的varStatus属性,具体代码如下:
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>序号</th>
<th>姓名</th>
</tr>
<c:forEach var="list" items="${list}" varStatus="status">
<tr>
<td>${ status.index + 1}</td>
</table>
备注:status.index是从0开始的。
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<th>序号</th>
<th>姓名</th>
</tr>
<c:forEach var="list" items="${list}" varStatus="status">
<tr>
<td>${ status.index + 1}</td>
<td>${ student.name}</td>
</tr>
<tr>
<c:if test="${status.index%2==0}">
这是奇数
</c:if>
<c:if test="${status.index%2!=0}">
这是偶数
</c:if>
</tr>
</c:forEach></table>
备注:status.index是从0开始的。
0 0
- [JSP] c:forEach 输出序号判断奇偶数作不同处理
- [JSP] c:forEach 如何输出序号
- [JSP] c:forEach 如何输出序号
- [JSP] c:forEach 如何输出序号
- [JSP] c:forEach 如何输出序号
- [JSP] c:forEach 如何输出序号
- jsp中 c:forEach 如何输出递增序号
- jsp中 c:forEach 如何输出递增序号
- 《JSP极简教程》c:forEach 如何输出序号
- c:forEach 如何输出序号
- c:forEach 如何输出序号
- C语言判断奇偶数
- forEach 如何输出序号
- 输出一定范围内的奇偶数(foreach/section/if_elseif_else)
- <c:forEach>循环list,<c:if>判断奇偶
- 在jsp页面中设置<c:foreach>中序号
- jsp中<c:foreach>标签的序号问题
- 多线程之同步输出奇偶数[C#]
- C++的explicit关键字
- (4.1.13)Android之Notification的多种用法
- Angularjs ng-options用法
- MQTT 协议 Client ID 长度不能超过23个字符(MqttException: MQIsdp ClientId > 23 bytes)
- iOS 自定义cell的高度
- [JSP] c:forEach 输出序号判断奇偶数作不同处理
- hadoop集群安装
- 医疗保险公司资料外泄,你该知道什么?
- (4.1.14)Android使用Activity用作弹出式对话框
- 关于 android 中 postDelayed方法的讲解
- vs2010 C++常见问题1:back_inserter
- Linux curl命令http请求3xx跳转解决办法
- 127 - "Accordian" Patience
- Hive 减少日期的函数 date_sub()