본문 바로가기
Thymeleaf

[Thymeleaf] 반복문에서 홀수/짝수 행 구별하기

by palbokdev 2022. 3. 22.
<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