在应用程序开发中,如果内容过长,想截取一定长度字符,然后补充"....." jstl1.1引入了一个fn.tld的标签,用于处理字符,如获得字符length,substring,indexof,endWith,lowcase 实现截取字符串 如: <c:set var="log.logTitle" value="做一个截取字符串长度的测试" <c:choose> <c:when test="${fn:length(log.logTitle) > 10}"> <c:out value="${fn:substring(log.logTitle, 0, 10)}......" /> </c:when> <c:otherwise> <c:out value="${log.logTitle}" /> </c:otherwise> </c:choose>此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/68896.html