jstl 自定义标签
<!--tld文件--> <?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"> <tlib-version>1.0</tlib-version> <short-name>demo</short-name> <uri>/WEB-INF/tags/tld/functionTag.tld</uri> <!--方法 --> <function> <name>demo</name> <function-class>com.demo.utils.functionTag.JstlTagUtil</function-class> <function-signature>java.lang.String demo(java.lang.String)</function-signature> </function> </taglib>
package com.demo.core.utils.functionTag;public class JstlTagUtil { //demo对应的类和方法 public static String demo(String id){return id; } }
<!--web.xml文件添加--> <jsp-config> <taglib> <taglib-uri>/tags/tld/functionTag</taglib-uri> <taglib-location>/WEB-INF/tags/tld/functionTag.tld</taglib-location> </taglib> </jsp-config>
<!--jsp文件引入--> <%@ taglib prefix="demo" uri="/WEB-INF/tags/tld/functionTag.tld"%><br /><br /><p>${demo:demo('id')}</p>
相关推荐
与卿画眉共浮生 2020-10-14
xiyang 2020-08-21
baijinswpu 2020-07-29
leonranri 2020-07-26
zhongliwen 2020-07-05
麋鹿麋鹿迷了路 2020-07-05
zengyu00 2020-07-05
XGQ 2020-07-04
CoderBoy 2020-06-28
whbing 2020-06-28
绝望的乐园 2020-06-27
wellfly 2020-06-26
菇星獨行 2020-06-25
草原孤狼 2020-06-25
坚持着执着 2020-06-16
wcqwcq 2020-06-14
yuanye0 2020-06-14
zhongliwen 2020-06-13
MrFuWen 2020-06-09