怎样截取JSp.EL表达式的字符串

首先引入标签库  <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<c:set var="f.content" value="${f.content}" />

       <c:choose>

          <c:when test="${fn:length(f.content) > 10}">

            <c:out value="${fn:substring(f.content, 0, 10)}......" />

           </c:when>

           <c:otherwise>

             <c:out value="${f.content}" />

             </c:otherwise>

   </c:choose>

转载于:https://my.oschina.net/swchenml/blog/487617

THE END
< <上一篇
下一篇>>