引入方式示例:
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.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">
<description>JSTL 1.1 functions library</description>
<display-name>JSTL functions sys</display-name>
<tlib-version>1.1</tlib-version>
<short-name>fns</short-name>
<uri>http://java.sun.com/jsp/jstl/functionss</uri>
<!-- DictUtils -->
<function>
<description>获取字典对象列表</description>
<name>getDictList</name>
<function-class>com.sdyy.base.sys.utils.DictUtils</function-class>
<function-signature>java.util.List getDictList(java.lang.String)</function-signature>
<example>${fns:getDictList(typeCode)}</example>
</function>
<function>
<description>获取字典对象列表</description>
<name>getDictListJson</name>
<function-class>com.sdyy.base.sys.utils.DictUtils</function-class>
<function-signature>java.lang.String getDictListJson(java.lang.String)</function-signature>
<example>${fns:getDictListJson(typeCode)}</example>
</function>
<function>
<description>对象变json</description>
<name>toJSONString</name>
<function-class>com.alibaba.fastjson.JSON</function-class>
<function-signature>java.lang.String toJSONString(java.lang.Object)</function-signature>
</function>
</taglib>
function-class就是该方法的实体所在类路径,
function-signature就是该方法的方法名,值得一提的是,这个方法必须是个static方法。
example就是使用方法示例