Skip to content

Commit 3998fff

Browse files
felipeazvpivovarit
authored andcommitted
[BAEL-1671] Iteration in Thymeleaf (eugenp#3987)
* [BAEL-1671] Iteration in Thymeleaf * [BAEL-1671] Iteration in Thymeleaf * [BAEL-1671] Iteration in Thymeleaf
1 parent ba1ba84 commit 3998fff

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spring-thymeleaf/src/main/webapp/WEB-INF/views/listStudents.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,23 @@ <h1>Student List</h1>
2222
<th th:text="#{msg.name}" />
2323
<th th:text="#{msg.gender}" />
2424
<th th:text="#{msg.percent}" />
25+
<th th:text="index" />
26+
<th th:text="count" />
27+
<th th:text="first" />
28+
<th th:text="last" />
2529
</tr>
2630
</thead>
2731
<tbody>
28-
<tr th:each="student: ${students}">
32+
<tr th:each="student, iStat : ${students}" th:style="${iStat.odd}? 'font-weight: bold;'" th:alt-title="${iStat.even}? 'even' : 'odd'">
2933
<td th:text="${student.id}" />
30-
<td th:text="${{student.name}}" />
34+
<td th:text="${student.name}" />
3135
<td th:switch="${student.gender}"><span th:case="'M'"
3236
th:text="Male" /> <span th:case="'F'" th:text="Female" /></td>
3337
<td th:text="${#conversions.convert(student.percentage, 'Integer')}" />
38+
<td th:text="${iStat.index}" />
39+
<td th:text="${iStat.count}" />
40+
<td th:text="${iStat.first}" />
41+
<td th:text="${iStat.last}" />
3442
</tr>
3543
</tbody>
3644
</table>

0 commit comments

Comments
 (0)