1、th:each=“i:${#numbers.sequence()}“中使用参数:
直接下面这样用会报错:
th:each="i:${#numbers.sequence(1,${totalPage})}"
应该把里面的括号去掉,就能用了:
th:each="i:${#numbers.sequence(1,totalPage)}"
2、th:each
和th:switch
联合使用:
<li class="li3 floatLeft wid35"
th:each="i:${#numbers.sequence(1,totalPage)}"
th:switch="${currentPage}">
<div class="indexSelected" th:case = "${i}">
<h1 class="fontNor textAlCenter font10 rgbTextWhite" th:text="${i}"></h1>
</div>
<div class="indexNotSelected" th:case="*" onmouseover="this.style.color='red';"
onmouseout="this.style.color='black';">
<h1 class="fontNor textAlCenter font10" th:text="${i}"></h1>
</div>
</li>