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」產品只有。我怎樣才能做到這一點?