title: dynamically adding input field for List child object in thymeleaf
body: <p>I am trying to add an input field for child object in thymeleaf by jquery but I could not get the child object value in the controller.</p>
  
  <p>Here's my code </p>
  
  <blockquote>
    <p>Parent class TestList</p>
  </blockquote>
  
  <pre><code>private String inputField;
  
  private List&lt;ProjectTask&gt; projectTasks = new ArrayList&lt;&gt;();
  
  public TestList() {
      projectTasks = new ArrayList&lt;ProjectTask&gt;();
  }
  </code></pre>
  
  <blockquote>
    <p>Child class ProjectTask</p>
  </blockquote>
  
  <pre><code>String taskName;
  boolean isTaskDone;
  </code></pre>
  
  <blockquote>
    <p>And my jquery for creating dynamic input field, here index is a counter</p>
  </blockquote>
  
  <pre><code>$(
              '&lt;input type="text" class="form-control quantity" '+
              'th:field="*{projectTasks[__'+index+'__].taskName}"&gt;'
          ).appendTo('#task');
  </code></pre>