개발/Spring Boot
thymeleaf에서 th if 사용법 else 그리고 null
멋진놈
2022. 7. 27. 11:21
728x90
if 부분
<div th:if="${board.fileList}">
else 부분
<div th:unless="${board.idx == null}">
<div th:unless="${board.idx == ''}">
도 가능
<div th:unless="${board.idx == 'gg'}">
<span>ㅎㅎ</span>
</div>
idx가 gg면 아래 ㅎㅎ 구문 가져오지마라는 뜻
정보를 준 사이트
https://webfirewood.tistory.com/94
thymeleaf에서 null check 하기(isEmpty)
오늘의 미션, 만약 view 단에서 보여줘야 하는 데이터가 없으면(아마도 DB에서 삭제된 경우) 프론트단에 데이터를 보여주는 div 태그를 없애야 한다. 아 그야 식은 죽 먹기죠. data가 null인지 아닌지
webfirewood.tistory.com