본문 바로가기
자바의 봄(Spring)/프로젝트

Thymeleaf로 새 게시글에 NEW 표시하기

by 종안이 2022. 12. 21.

<th:block th:if="${board.creationTime.after(#dates.createToday())}">
    <div><img th:src="@{/img/New.png}" style="width:50px; height:20px;"></div>
</th:block>

게시글의 시간과 dates.createToday()의 시간을 비교하여 NEW를 붙이게 된다.

 

@CreationTimestamp
private Date creationTime;

댓글