1,自定义标签
参考博客:https://blog.youkuaiyun.com/qq_35076190/article/details/88425620
2,获取.tag标签中输入的值
当我们自定义的标签,需要对value值,进行自定义格式去显示的时候。
这个时候可以使用: <jsp:body var="value">
<%=jspContext.getAttribute("value").toString()%>参考博客:https://blog.youkuaiyun.com/panchang199266/article/details/80794628
<%@tag import="com.x.base.util.CommonUtil"%> <%@tag import="com.x.base.util.StringUtil"%> <%@tag pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %> <jsp:doBody var="value"/> <%@attribute name="num" required="true" rtexprvalue="true"%> <%=StringUtil.cutString(jspContext.getAttribute("value").toString(),Integer.valueOf(jspContext.getAttribute("num").toString()))%>