title: Can't get values submitted using thymeleaf
body: <p>I am new with thymeleaf and I am having a doubt about how to retrieve a field from html (using Thymeleaf) to Java (Spring Boot). Follow the code and the error that I am having:</p>
  
  <p>HTML (part with issue)</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
  &lt;meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1.0" /&gt;
  &lt;title&gt;Entity Migration&lt;/title&gt;
  
  &lt;!-- CSS  --&gt;
  &lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet"&gt;
  
  &lt;link href="css/style.css" type="text/css" rel="stylesheet"
      media="screen,projection" /&gt;
  &lt;link href="css/materialize.css" type="text/css" rel="stylesheet"
      media="screen,projection" /&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav class="light-blue lighten-1" role="navigation"&gt;
          &lt;div class="nav-wrapper container"&gt;
              &lt;a id="logo-container" href="#" class="brand-logo"&gt;Entity
                  Migration&lt;/a&gt;
              &lt;ul class="right hide-on-med-and-down"&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
  
              &lt;ul id="nav-mobile" class="side-nav"&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Entity Migration&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
              &lt;a href="#" data-activates="nav-mobile" class="button-collapse"&gt;&lt;i
                  class="material-icons"&gt;Logout&lt;/i&gt;&lt;/a&gt;
          &lt;/div&gt;
      &lt;/nav&gt;
      &lt;div class="section no-pad-bot" id="index-banner"&gt;
          &lt;div class="container"&gt;
              &lt;br&gt; &lt;br&gt;
              &lt;div class="row center"&gt;
                  &lt;h5 class="header col s12 light"&gt;Fill the form below to
                      generate your XML:&lt;/h5&gt;
              &lt;/div&gt;
              &lt;br&gt; &lt;br&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;form class="col s12" action="#" th:action="@{/prepareData}" th:object="${entity}" method="post"&gt;
          &lt;div class="row"&gt;
              &lt;div class="input-field col s4"&gt;
                  &lt;input type="number" id="release" name="release" placeholder="Release" 
                      class="validate" th:value="*{release}"/&gt;
  
              &lt;/div&gt;
              &lt;div class="input-field col s4"&gt;
                  &lt;input placeholder="Version" id="version" name="version" type="number"
                      class="validate" th:value="*{version}"/&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;input type="submit" value="Generate XML" id="generate"
                  class="btn-large waves-effect waves-light orange" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
          &lt;!--  Scripts--&gt;
      &lt;script src="https://code.jquery.com/jquery-2.1.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/init.js"&gt;&lt;/script&gt;
      &lt;script src="js/materialize.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function() {
              $('select').material_select();
          });
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Java (Spring Boot Controller)</p>
  
  <pre><code> @PostMapping(value = "/prepareData")
    public String prepareData(@ModelAttribute(value="entity") EntityMigration entity) {
      TemplatePrepare tP = new TemplatePrepare();
      tP.prepareMainTemplate(entity);
      return "results";
  </code></pre>
  
  <p>EntityMigration (Java Model)</p>
  
  <pre><code>public class EntityMigration {
  
      private String release;
      private String version;
  
      public String getRelease() {
          return release;
      }
      public void setRelease(String release) {
          this.release = release;
      }
      public String getVersion() {
          return version;
      }
      public void setVersion(String version) {
          this.version = version;
      }
  }
  </code></pre>
  
  <p>Error </p>
  
  <pre><code>    2017-11-16 14:01:02.445 ERROR 26932 --- [nio-8080-exec-1] org.thymeleaf.TemplateEngine             : [THYMELEAF][http-nio-8080-exec-1] Exception processing template "mainForm": An error happened during template parsing (template: "class path resource [templates/mainForm.html]")
  
  org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/mainForm.html]")
  </code></pre>
  
  <p>(...)</p>
  
  <pre><code>Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "release" (template: "mainForm" - line 55, col 23)
  </code></pre>
  
  <p>(...)</p>
  
  <pre><code>org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'release' cannot be found on null
  </code></pre>
  
  <p>(...)</p>
  
  <p>What am I doing wrong?
  Thank you.</p>