1
我有一个产品对象列表,我想根据一些条件在HTML页面中迭代它。我想这个迭代只为产品,产品类型为“BAR”。我做了如下。Thymeleaf - 迭代基于对象属性的对象列表
<th:block th:if="${#strings.isEmpty(foo.destination)}" >
<div th:each ="product, prodStat:${foo.productList}" th:if="${product.type eq 'BAR'}" th:with="bar=${product}">
<div th:text="${bar.cityName}">London</div>
</div>
</th:block>
但现在我要的产品列表进行迭代只为第5“BAR”产品只有。我怎样才能做到这一点?