【发布时间】:2019-07-04 21:37:15
【问题描述】:
我正在尝试遍历包含对象列表的列表,即 List 我想知道为什么这不起作用,只尝试了“i”,但没有运气。
List<Object[]> lists; // logic
model.addObject("lists", lists);
model.addObject("table_width", lists.get(0).length);
Thymeleaf 代码片段
<table class="table table-responsive table-stripped table-collapsed table-bordered">
<tr th:each="rows,rowStat : ${lists}">
<td th:text="${rowStat.count}"></td>
<td th:each="i : ${#numbers.sequence(0, table_width)}" th:text="${rows[${i}]}"></td>
</tr>
</table>
【问题讨论】:
标签: spring spring-boot thymeleaf