Thymeleaf中获取index

<tr th:each="user,userStat:${users}">

userStat是状态变量,有 index,count,size,current,even,odd,first,last等属性,如果没有显示设置状态变量,thymeleaf会默 认给个“变量名+Stat"的状态变量。

就是:将所传对象如:user,加上Stat变成userStat即可使用

${userStat.index}

猜你喜欢

转载自blog.csdn.net/qq_31293575/article/details/84527517