thymeleaf中处理date回显到input标签type='date'的方法

实体类要加注解,实现string--->date的转换和date--->string的转换

@DateTimeFormat(pattern="yyyy-MM-dd")
private Date createTime;

前端写法

<input type="text" name="createTime" th:value="${#dates.format(test.createTime, 'yyyy-MM-dd')}" >

  

猜你喜欢

转载自www.cnblogs.com/super-hu/p/12127029.html