thymeleaf 循环标签问题
给 位大神 :我想实现的是 : 后台拿到数据 n条 ,每3个数据显示一行 .我就需要 每三个数据外 包含 div
0 1 2
div span span span /div
3 4 5
div span span span /div
以前用jsp 很简单 ,循环 span ,%3 的时候包一个div 就可以了 ,但是
thymeleaf 怎么包含 单个 div ,要报错
<div th:each = "teacher,teacherStat:${teachers}" >
<th:block th:if="${teacherStat.index % 3 eq 0}">
<div>
</th:block>
<div class="col-sm-4"></div>
<div class="app-block wow bounceInUp" th:attr="data-wow-delay=@{${'.'+teacherStat.index+'s'}} ">
<i class="fa " th:text="${teacher.name}"></i>
</div>
<th:block th:if="${teacherStat.index+1 % 3 eq 0}">
</div>
</th:block>
</div>