我是Thymeleaf的新手,我需要做这样的事情:
<div th:each="element : ${list}" th:with="test=false">
<div th:each="element2 : ${list2}">
<div th:if="element2.name == 'someName'">
<div th:with="test=true">test changed</div>
</div>
</div>
<div th:text="${test}"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
如果我尝试这个代码我看到"测试已更改"但我的变量测试始终为false