百里香 - 如何按索引循环列表
2022-08-31 23:45:21
如何按索引循环?
傅.java
public Foo {
private List<String> tasks;
...
}
索引.html
<p>Tasks:
<span th:each="${index: #numbers.sequence(0, ${foo.tasks.length})}">
<span th:text="${foo.tasks[index]}"></span>
</span>
</p>
我收到解析错误
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as each: "${index: #numbers.sequence(0, ${student.tasks.length})}"