小编Daw*_*d K的帖子

Thymeleaf改变变量

我是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

java spring thymeleaf

8
推荐指数
1
解决办法
2363
查看次数

标签 统计

java ×1

spring ×1

thymeleaf ×1