thymeleaf 自动生成表格索引 连续id
完美解决前端显示数据库id不连续
<tbody>
<!-- 遍历lists -->
<tr th:each="list:${lists}">
<!--list就是我们所获得的数据,在list变量后加Stat,即listStat,它就变成了所谓的状态变量,每输出一行数据序号+1-->
<td th:text="${listStat.index+1}"></td>
<td th:text="${list.getLastname()}"></td>
·······
</tr>
</tbody>