我如何使此表计数器位置(例如位置1,2、3、4)循环,还是我也必须从Java发送它?
<tr th:each="player : ${getStatsResponsePvp}">
<td th:with="place=${player.counter + 1}"th:text="${place}"></td>
<td th:text="${player.CharName}"></td>
<td th:text="${player.Level}"></td>
<td th:text="${player.ClassName}"></td>
<td th:text="${player.PvpKills}"></td>
<td th:text="${player.PkKills}"></td>
<td th:text="${player.OnlineText()}"></td>
<td>
<span th:if="${player.online} == 0"
class="label label-danger">Offline</span>
<span th:if="${player.online} == 1"
class="label label-primary">Online</span>
</td>
</tr>
答案 0 :(得分:0)
您需要使用Thymeleaf's iteration status。尝试类似的东西:
<tr th:each="player,status = ${getStatsResponsePvp}">
然后您可以使用${status.count}
来枚举您正在使用的玩家。