如果是springboot项目,在application.properties中添加
spring.jackson.date-format= yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone= GMT+8
是没有用的,因为这个是格式化json的日期的返回格式。
这时候通过查阅资料,使用
<fmt:formatDate value="${}" pattern="yyyy-MM-dd HH:mm:ss"/>
这种格式来写,你会发现你的服务器内部报500错误
According to TLD or attribute directive in tag file, attribute [items] does not accept any expressions
类似这种。
其实这并不是你的表达式有问题,而是因为解析出了问题。
这时候需要更换一下标签库
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
可以看到主要就是最后的fmt和core都加了_rt
这样就可以解决问题了
原理大致是之前的标签库依赖于EL来实现,RT库不依赖。