频道栏目
首页 > 资讯 > Jsp > 正文

JSP常用的el表达式:判断是否为空、循环、比较、索引等实例讲解

18-07-31        来源:[db:作者]  
收藏   我要投稿

1、判断是否为空

如果为空

 <c:if test="${empty  allContactStatsPerMonth}">
     <ul class="def_report_td">
       <div style="text-align: center;">
             暂无数据
        </div>
      </ul>
 </c:if>

如果不为空

<c:if test="${not empty  allContactStatsPerMonth}">
不为空,展示数据
</c:if>

2、循环用<c:forEach></c:forEach>、当前list的索引${p.index}(注意:p是事先声明的。varstatus=“p”)

<c:forEach items="${allContactStatsPerMonth}" var="contactStatsPerMonth" varStatus="p">
     <c:if test="${p.index <= 50}">
           <ul class="def_report_td contact_area_analysis">
              <li style="width: 7%;">${contactStatsPerMonth.month}</li>  
            </ul>
      </c:if>
 </c:forEach>
相关TAG标签
上一篇:Mac下搭建vue环境的实例教程
下一篇:关于嵌套路由配置的实例教程
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站