title: PreSelect Value from Dropdown
body: <p>I was able to populate my dropdown, however I cannot preselect the value of the dropdown base on the value coming from DB. </p>
  
  <p>My Thymeleaf</p>
  
  <pre><code>   &lt;select id="inputstatus" name="status" th:field="*{status}" &gt;            
        &lt;option th:each="enumStatus : ${listStatus}"    
             th:value="${enumStatus.code}" 
             th:text="#{${enumStatus.value}}" /&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>My Controller:</p>
  
  <pre><code>@RequestMapping(value = "userdetails/{username}")
  public String getAccounts(@PathVariable String username, Model model) {
      Account accountDetail = rsAccountDetailsService.loadAccountByUserName(username);
      model.addAttribute(ACCNTSEARCH_MODEL_ACCNTSTATUS_KEY, AccountDetailsStatus.values());
      model.addAttribute("userdetailform",accountDetail);
  
  
      return "account/userdetails";
  
  }
  </code></pre>
  
  <p>My ENUM</p>
  
  <pre><code>public enum AccountDetailsStatus {
  ACTIVE(0, "status.active"),
  EXPIRED(2, "status.expired"),
  LOCKED(3, "status.locked");
  
  private int code;
  private String value;
  
  private final static class BootstrapSingleton {
      public static final Map&lt;String, AccountDetailsStatus&gt; lookupByValue = new HashMap&lt;String, AccountDetailsStatus&gt;();
      public static final Map&lt;Integer, AccountDetailsStatus&gt; lookupByCode = new HashMap&lt;Integer, AccountDetailsStatus&gt;();
  
  }
  
  AccountDetailsStatus(int code, String value) {
      this.code = code;
      this.value = value;
      BootstrapSingleton.lookupByValue.put(value, this);
      BootstrapSingleton.lookupByCode.put(new Integer(code), this);
  
  }
  
  public int getCode() {
      return code;
  }
  
  
  public String getValue() {
      return value;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>If the user details were loaded with for example "ACTIVE" status, the active status in the dropdown is not selected.</p>