1,在web.xml中添加:
<taglib-uri>http://jakarta.apache.org/taglibs/string-1.0</taglib-uri>
<taglib-location>/WEB-INF/taglibs-string.tld</taglib-location>
</taglib>
2,上传 taglibs-string.jar 到web-inf/lib,上传taglibs-string.tld到web-inf/。
3,在jsp中加入代码:
<%@ taglib uri="http://jakarta.apache.org/taglibs/string-1.0" prefix="str" %>
<str:substring start="0" end="40"><c:out value="${messages}"/></str:substring>