<div th:each="propName,iterStat : ${propNames}" th:class="${iterStat.odd}? 'odd' : 'even'">
...
</div
odd 홀수, even 짝수
ref : https://stackoverflow.com/questions/20675096/using-iteration-variable-in-thymeleaf
'Thymeleaf' 카테고리의 다른 글
[Thymeleaf] csrf 토큰 추가 (0) | 2023.06.19 |
---|---|
[Thymeleaf] 타임리프 날짜포맷 활용하기 (0) | 2023.06.01 |
[Thymeleaf] 자바스크립트 안에서 loop 돌기 (0) | 2023.05.30 |
[Thymeleaf] 타임리프를 활용하여 스프링 모델 값 가져오기 (0) | 2023.05.24 |
[Thymeleaf] LocalDate 원하는 날짜 형식으로 출력하기 (0) | 2022.09.13 |