datetag.tld文件:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> <taglib> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> <short-name>date</short-name> <uri>http://com.demo.util.datejstl/tags</uri> <tag> <name>date</name> <tag-class>com.demo.util.jstl.JSTLUtil</tag-class> <attribute> <name>value</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>parttern</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag> </taglib>
在Jsp页面中引用:
<%@ taglib uri="http://com.demo.util.datejstl/tags" prefix="date"%>
在Jsp页面中用法:
<date:date value="${time}" parttern="yyyy-MM-dd HH:mm:ss"></date:date></div>