title: Thymeleaf dropdown selection
body: <p>I am using Thymeleaf for one of my java projects. 
  Now, what I am trying to achieve, is when i choose something else from the drop down, and not a default value which is "ALL", and then press submit button [POST], to get the details about the chosen item. I would like to keep that chose item displaying in the drop down, after the submission. And what it does now, it returns back to default value. If I add to the provided code below attribute selected, then it selects all items from the list, which is not acceptable as well, as it end up always displaying the last item of the list.</p>
  
  <pre><code>&lt;div class="controls"&gt;
      &lt;select class="form-control" name="example" id="example"&gt;
          &lt;option value="0"&gt;ALL&lt;/option&gt;
          &lt;option th:each="user : ${allUsers}" th:value="${user.id}" th:text="${user.name}"&gt;
          &lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my controller to get the list, I kept it as simple as possible:</p>
  
  <pre><code>@ModelAttribute("allUsers")
  public List&lt;User&gt; allUsers() {
      List&lt;User&gt; userList= repo.findAll();
      return userList;
  }
  </code></pre>
  
  <p>also I would like to note, that my object is:</p>
  
  <pre><code>&lt;form class="form-search" action="#" method="post"
        th:action="@{/combinedsearch}"
        th:object="${combinedreport}"&gt;
  </code></pre>
  
  <p>So the idea to use something like this doesn't work</p>
  
  <p><code>&lt;select th:field="*{user}"&gt;</code>, as my object doesn't actually have User as a field.</p>
  
  <p>Any ideas? Help?</p>