How to format a timestamp string as a time tag, jsp string
Datetag. tld file:
<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE taglibPUBLIC "-//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>
Reference in Jsp page:
<%@ taglib uri="http://com.demo.util.datejstl/tags" prefix="date"%>
Use in Jsp pages:
<date:date value="${time}" parttern="yyyy-MM-dd HH:mm:ss"></date:date></div>
Format the Time of the string type to the specified type on the jsp page
Use struts labels or jstl expressions, especially.
<S: date name = **** format = "yy-MM-DD"/> specific how to write in Baidu directly search struts date label usage is OK, I hope to help you.
JSP date formatting
<% @ Page contentType = "text/html; charset = gb2312" %>
<% @ Page import = "java. util. *" %>
<% @ Page import = "java. text. *" %>
<Html>
<Body>
Current Time:
<% SimpleDateFormat s = new SimpleDateFormat ("yyyyMMddHHmmss ");
Date date = new Date ();
%>
<% = S. format (date) %>
</Body>
</Html>