1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <div> <h4>반복문(each)</h4> - 지정한 횟수만큼 반복 : #numbers유틸리티의 sequence(시작, 종료) 함수 사용<br/> <th:block th:each="num : ${#numbers.sequence(1, 5)}"> <span>안녕</span> / <span th:text="${num}"></span><br/> </th:block> <br/> <th:block th:each="num : ${#numbers.sequence(1, 10)}"> <th:block th:with="tot = ${num * (num + 1) /2}"> <div th:text="'1~' + ${num} + '까지의 합은? ' + ${tot}"></div> tot = [[${tot}]]<br/> </th:block> </th:block> </div> | cs |
다음검색