Search code examples
thymeleaf

How to loop through 1 to 5 in thymeleaf?


I want to loop through 1 to 5 in the thymeleaf, similar to jsp code:

<c: forEach begin = "1" end = "5" varStatus = "V"> </ c: forEach>.

Solution

  • <th:block th:each="i: ${#numbers.sequence(1, 5)}"></th:block>