【发布时间】:2014-06-26 05:30:10
【问题描述】:
是否可以在 Thymeleaf 的“每个”循环中调用对象的方法?我正在尝试创建一个动态表,其中行和列都可以是动态的。一个表有一个行列表和一个列列表。 Column 有一个 getValue 方法,对于给定的 Row 可以获取该值。但我无法从 Thymeleaf 调用这个 getValue(Row row)。
我有这个 Thymeleaf 代码:
<table>
<tr th:each="row : ${table.rows}">
<td th:each="column : ${table.columns}">
<span th:text="${column.value(row)}"/>
</td>
</tr>
</table>
这会导致异常:
Exception evaluating SpringEL expression: "column.value(row)"
是否可以在 Thymeleaf 中执行此操作,例如将变量传递给其他变量的方法?
【问题讨论】:
标签: html-table thymeleaf