牛骨文教育服务平台(让学习变的简单)
博文笔记

Jsp中EL表达式中list的各种用法

创建时间:2012-11-01 投稿人: 浏览次数:3190

都要引入:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

1、list为空:

<c:if   test= "${!empty   list} ">

2、list的size大于0:

必须引入:<%@ taglib prefix= "fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<c:if test="${fn:length(list)>0}">

3、控制字段长度:

必须引入<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>  

<c:choose>  

<c:when test="${fn:length(content.content) > 12}">  
<c:out value="${fn:substring(content.content, 0,10)}..." />  
</c:when>  
<c:otherwise>  
<c:out value="${content.content }" />  
</c:otherwise>  
</c:choose>  


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。