2

I find Thymeleaf th:each is not working properly on <form> element when ${items} is empty.

<form th:each="item,iterStat : ${items}" >
    <span th:text="${iterStat.size}"> Hello </span>
</form>

org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'size' cannot be found on null

But, it is ok on <div> element

<div th:each="item,iterStat : ${items}" >
    <span th:text="${iterStat.size}"> Hello </span>
</div>

The Thymeleaf is included in Spring Boot v1.5.4.RELEASE

Why?

Raymond
  • 885
  • 10
  • 28

0 Answers0