title: Thymeleaf: re-assign a local variable
body: <p>I've a code like this:</p>
  
  <pre><code>&lt;div th:each="element : ${list}" th:with="test=false"&gt;
      &lt;div th:each="element2 : ${list2}"&gt;
          &lt;div th:if="element2.name == 'someName'"&gt;
              &lt;div th:with="test=true"&gt;test changed&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div th:text="${test}"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>but the variable "test" is always is always false. What can I do?</p>