jsp页面中使用jstl判断长度<c:choose><c:when>
在jsp页面中引入c和fn
<%@ taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>
<%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn” %>
长度大小要使用单引号
如果文本内容长度大于315,就只显示315个字符,后面用省略号代替
<c:choose>
<c:when test="${fn:length(entity.content)>‘315’}">
${fn:substring(entity.content,0,315)}…
</c:when>
<c:otherwise>
${entity.content}
</c:otherwise>
</c:choose>
jsp页面中使用jstl判断长度
最新推荐文章于 2022-11-10 08:51:00 发布