应用程序采用sprigmvc,Thymeleaf来作为view层的数据展示。页面中试用th:each标签来遍历后端传来的List。需要取到index。
大家讲道理2017-04-17 15:18:33
<tr th:each="user,userStat:${users}">
userStat is a status variable with attributes such as index, count, size, current, even, odd, first, last, etc. If the status variable is not set explicitly, thymeleaf will default to "variable name + Stat" "'s state variable.
天蓬老师2017-04-17 15:18:33
The official document I read here is that the state variables are called iterStat by default. It is possible to test it yourself.