我正在尝试迭代一个列表并将当前迭代和另一个模型变量传递给片段,但"其他"模型变量始终为空。
<div th:each="place : ${results.placeResults}" class="col-sm-6 col-xl-4 mb-5">
<div th:replace="fragments/placecard :: placecard" th:with="place=${place},res=${results}"/>
</div> <!-- end for each-->
在片段中,${res}
始终为空。
我想通了,th:replace
基本上使th:with
没有效果。 我更改了代码以使用th:include
,事情看起来更好。