如何更改百里香叶中变量的值?

Akh*_*ran 7 html thymeleaf

我是百里香的新手。我现在有点困惑。请查看下面的代码

  <th:block th:with="${someVarible=false}">
    <th:block th:each="dem : ${demo}">
       <th:block th:if="${dem.status==0}">
             //Here I need to change the value of someVarible to true
       </th:block>
    </th:block>
    <th:block th:if="${someVariable}">Its true</th:block>
  </th:block>
Run Code Online (Sandbox Code Playgroud)

我需要编辑 someVarible 的值。我该怎么做。提前致谢。

san*_*uck 0

你有表格吗?你如何发送数据到服务器?

如果您的变量为布尔类型,您可以添加例如用于编辑的复选框:

<th:block th:with="${someVarible=false}">
<th:block th:each="dem : ${demo}">
   <th:block th:if="${dem.status==0}">
         <label for="someVariableCheck">Edit someVariable</label>    
         <input id="someVariableCheck" type="checkbox" th:value="${someVariable}"/>
   </th:block>
</th:block>
<th:block th:if="${someVariable}">Its true</th:block>
Run Code Online (Sandbox Code Playgroud)