How to format a timestamp string into a timestamp in JSP page

Time:2020-9-15

datetag.tld Document:


<?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>

In the JSP page, reference:


<%@ taglib uri="http://com.demo.util.datejstl/tags" prefix="date"%>

In the JSP page usage:


<date:date value="${time}" parttern="yyyy-MM-dd HH:mm:ss"></date:date></div>

Recommended Today

Java security framework

The article is mainly divided into three parts1. The architecture and core components of spring security are as follows: (1) authentication; (2) authority interception; (3) database management; (4) authority caching; (5) custom decision making; and;2. To build and use the environment, the current popular spring boot is used to build the environment, and the actual […]