您的位置:首页 > 编程语言 > Java开发

《SpringBoot极简教程》JSP格式化输出日期

2017-09-13 14:26 351 查看

引入tablib:fmt

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

实例代码如下:

<fmt:formatDate pattern="yyyy/MM/dd HH:mm:ss" value="${blog.gmtModified}"/>

完整jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
<jsp:include page="../header.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../top-nav.jsp"></jsp:include>
<div class="col-sm-12">
<div>${blog.title}</div>
<div>作者: ${blog.author} 日期: <fmt:formatDate pattern="yyyy/MM/dd HH:mm:ss" value="${blog.gmtModified}"/></div>
<div>${blog.content}</div>
</div>
<jsp:include page="../footer.jsp"></jsp:include>
<footer class="panel-footer rest-footer">
<div class="footer-nav">
<a href="/" target="_blank" hidefocus="true">RestFeel</a>
|
<a href="https://universsky.github.io/" target="_blank">光剑免费图书馆</a>
|
<a href="https://jason-chen-2017.github.io/Jason-Chen-2017/" target="_blank">博客</a>
|
<a href="#" target="_blank" hidefocus="true">微信公众号:ols-lightshadow</a>
</div>
<div class="copyright">RestFeel 2017-7017</div>

</footer>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: