【发布时间】:2015-08-25 10:44:22
【问题描述】:
我有一个产品对象列表,我想根据某些条件在 HTML 页面中对其进行迭代。我只想针对产品类型为“BAR”的产品进行迭代。我已经这样做了。
<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”产品进行迭代。我怎样才能做到这一点?
【问题讨论】:
标签: spring-mvc thymeleaf