码迷,mamicode.com
首页 > Web开发 > 详细

JSTL标签+EL表达式遍历List内容

时间:2015-01-21 18:10:06      阅读:469      评论:0      收藏:0      [点我收藏+]

标签:

经常用到以下代码遍历呈现后台返回来的List,特此Mark一下:

JSP页面头部引用JSTL标签:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

JSP内容:

<c:if test="${tradeList==null || fn:length(tradeList) == 0}">
<tr>
  <td colspan="4">还没有人购买过该商品,快来抢购吧!</td>
</tr>
</c:if>
<c:forEach items="${tradeList}" var="item" varStatus="status">
  <tr >
    <td class="center"><span class="center">${item.trade_name}</span></td>
    <td><dfn>¥</dfn>${item.trade_price}</td>
    <td>${item.trade_count}</td>
    <td>${item.trade_time}</td>
  </tr>
</c:forEach>




JSTL标签+EL表达式遍历List内容

标签:

原文地址:http://blog.csdn.net/lutinghuan/article/details/42971417

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!