JSP中foreach标签(JSTL)的使用
2017-02-28 09:51
453 查看
http://blog.csdn.net/zlxdream815/article/details/25723981
在使用foreach标签之前,需要在JSP中导入标签
jsp页面itertor或forEach循环输出list:
http://blog.csdn.net/abcjiecba/article/details/6624970
JSP遍历后台传过来的List(总结的比较好):
三种方法:使用jstl标签
使用jsp内嵌Java代码遍历list(在后台把list放到session中)
使用struts标签
http://blog.csdn.net/kalision/article/details/8512700
在使用foreach标签之前,需要在JSP中导入标签
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<table align="center" width="98%" border="0" cellspacing="1" cellpadding="0" class="resulttable"> <tr> <th width="18%">卡种类型</th> <th width="82%">卡种等级</th> </tr> <c:if test="${ empty command.cardList}"> <tr><td align="center" colspan="10" class="oddbgc" >无记录</td> </tr> </c:if> <c:if test="${ not empty command.cardList}"> <c:forEach var="bean" items="${ command.cardList}" varStatus="s"> <c:if test="${bean.dataLevel=='1'}"> <tr> <td align="left" class="<c:choose ><c:when test='${s.index%2 ==0}'>oddbgc</c:when><c:otherwise>evenbgc</c:otherwise></c:choose>"> <c:out value="${bean.cardName}"/> </td> <td align="left" class="<c:choose ><c:when test='${s.index%2 ==0}'>oddbgc</c:when><c:otherwise>evenbgc</c:otherwise></c:choose>"> <c:forEach var="childbean" items="${ command.cardList}" varStatus="sr"> <c:if test="${bean.cardCode eq childbean.parentCardCode}"> <c:out value="${childbean.cardName}"/> </c:if> </c:forEach> </td> </tr> </c:if> </c:forEach> </c:if> </table>
jsp页面itertor或forEach循环输出list:
http://blog.csdn.net/abcjiecba/article/details/6624970
JSP遍历后台传过来的List(总结的比较好):
三种方法:使用jstl标签
使用jsp内嵌Java代码遍历list(在后台把list放到session中)
使用struts标签
http://blog.csdn.net/kalision/article/details/8512700
相关文章推荐
- 如何在JSP页面中使用JSTL标签实现if和if-else判断
- JSP基础语法之十六:JSTL配置和核心标签(C)的使用
- WEB开发的jsp例子标签库(jstl)的使用
- 【JSP】JSTL核心标签库的使用方法和示例
- 使用JSTL开发jsp自定义标签开发
- 如何在JSP页面使用JSTL标签获取List的元素个数
- jstl嵌套标签foreach使用
- JSP页面中使用JSTL标签出现无法解析问题解决办法
- 在jsp中使用jstl标签的常规用法
- 使用JSTL开发jsp自定义标签开发---迭代标签
- JSP EL标签不能和struts tag 一起使用,只能和JSTL一起使用了。
- jsp中使用JSTL标签自动生成编号的方法(varStatus的应用)(转)
- 【JSP】JSTL使用core标签总结(不断更新中)
- jsp学习---mvc模式介绍和el表达式,jstl标签库的使用入门
- 【JSP】JSTL使用core标签总结
- EL表达式----JSP11个隐式对象----EL函数----JSTL核心标签if,foreach
- 如何在JSP页面中使用JSTL标签实现if-else判断
- 在jsp中 混合使用jstl标签.
- 使用JSP与JavaBean结合JSTL标签,完成图书查询功能