2017-04-23 1 views
-1

numberOfPages라는 모델에 하나의 변수를 추가하고이 변수를 무시하고 싶습니다. 나는 다음과 같은 것을 성취하고자 함을 의미합니다 :간단한 for 루프 in thymeleaf

for(int i = 1; i <= numberOfPages; i++) 

어떻게하면됩니까?

<div th:each="page : ${numberOfPages}"> 
    <span th:text="${page}">Some default text here</span> 
</div> 
+0

잠재적 복제본 : http://stackoverflow.com/questions/20633118/for-loop-in-thymeleaf – Bas

답변

0

당신은 같은 것을 의미합니다.

<div th:each="page : ${#numbers.sequence(1, __${numberOfPages}__)}"> 
    <span th:text="${page}">Some default text here</span> 
</div> 
0

당신이 찾고있는 수 있음 :