Project usage Thymeleaf Template , The page only needs to be displayed list Inside the front 3 Data , What should I do at this time , No jsp like that , have access to begin=“0”,end=“2”
such , It can be used at this time th:if="${userStat.index} lt 3 Determine the current iteration index , from 0 start . This is index attribute .lt namely
<, So you can get the 3 Data .
<tr th:each="user,userStat:${supplierVotes}" th:class="${userStat.odd}? 'odd'"
th:if="${userStat.index} lt 3" th:object="${user}"> <td
th:text="${userStat.count}">1</td> <a
th:href="@{/user/details(customerId=${user.customerId})}" target="_blank"><td
th:text="*{customerId}">1</td></a> <td th:text="${user.yearFlag}">1</td> <td
th:text="|${user.yearFlag} ${user.customerId}|">1</td> <td><span
th:if="${user.yearFlag == '2017'}"> Special offer </span></td> <td><a
th:href="@{/user/details(customerId=${user.customerId})}"
target="_blank"> details </a></td> </tr>
Technology