title: Thymeleaf: cannot pass a predefined value of hidden th:field
body: <p>There is a form with hidden value fields:</p>
  
  <pre><code>&lt;input type = "hidden" th:field="*{key}" value="keyapp" /&gt;
  &lt;input type = "hidden" th:field="*{secret}" value="supersecret" /&gt;
  </code></pre>
  
  <p>The problem is that these fields are passed as empty in the controller. Is there a way to pass thymeleaf fields with predefined in HTML values?</p>
  
  <p>Thanks and kind regards,
  Deniss</p>
  
  <p><strong>Updated:</strong></p>
  
  <p><code>th:object</code> definition: </p>
  
  <pre><code>&lt;form th:action="@{..//do-login}" method="POST" modelAttribute="authEntity" th:object="${authEntity}"&gt;
  </code></pre>
  
  <p><strong>AuthEntity class</strong></p>
  
  <pre><code>public class AuthEntity {
  
      private String key;
      private String secret;
      private String scope;
      private String grantType;
      private String username;
      private String password;
      // getters &amp; setters omitted //
  }
  </code></pre>
  
  <p><strong>Controller class</strong></p>
  
  <pre><code>@RequestMapping(value = "/do-login", method = RequestMethod.POST, produces = "application/json")
  public void doLogin(@ModelAttribute("authEntity") final AuthEntity authEntity,
                      final Model model, HttpServletResponse servletResponse,
                      HttpSession httpSession) throws IOException {
      log.info("Application Key: {}, Secret: {}", authEntity.getKey(), authEntity.getSecret());
  }
  </code></pre>