title: Input in array Thymeleaf
body: <p>I need choose values from one array and assign it to other array. Using Spring Thymeleaf. No idea how retrieve these choosed values.
  My classes:</p>
  
  <pre><code>@Entity
  public class Collaborator {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
  
     @NotNull
     @Size (min=3, max=32)
     private String name;
  
     @NotNull
     @ManyToOne (cascade = CascadeType.ALL)
     private Role role;
  
     public Collaborator() {}...
  
  @Entity
  public class Role {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @NotNull
      @Size(min = 3, max = 99)
      private String name;
  
      public Role() {}....
  </code></pre>
  
  <p>My controllers:</p>
  
  <pre><code>@RequestMapping("/project_collaborators/{projectId}")
  public String projectCollaborators(@PathVariable Long projectId, Model model) {
      Project project = mProjectService.findById(projectId);
      List&lt;Collaborator&gt; allCollaborators = mCollaboratorService.findAll();
      List&lt;Collaborator&gt; assignments = new ArrayList&lt;&gt;();
  
      if (project.getRolesNeeded()!=null) {
          for (int i=0;i&lt;project.getRolesNeeded().size();i++) {
              assignments.add(new Collaborator("Unassigned", project.getRolesNeeded().get(i)));
              assignments.get(i).setId((long) 0);
          }
      }
  
      model.addAttribute("assignments", assignments);
      model.addAttribute("allCollaborators", allCollaborators);
      model.addAttribute("project", project);
  
      return "project_collaborators";
  }
  
  @RequestMapping(value = "/project_collaborators/{projectId}", method = RequestMethod.POST)
  public String projectCollaboratorsPost(@ModelAttribute Project project, @PathVariable Long projectId, Model model) {
      Project p = mProjectService.findById(projectId);
  
  
      //mProjectService.save(project);
      return "redirect:/project_detail/{projectId}";
  }
  </code></pre>
  
  <p>And template:</p>
  
  <pre><code>            &lt;form th:action="@{'/project_collaborators/' + ${project.id}}" method="post" th:object="${project}"&gt;
                  &lt;label th:text="'Edit Collaborators: ' + ${project.name}"&gt;Edit Collaborators: Website Project&lt;/label&gt;
                  &lt;ul class="checkbox-list"&gt;
  
                      &lt;li th:each="a : ${assignments}"&gt;
                          &lt;span th:text="${a.role.name}" class="primary"&gt;Developer&lt;/span&gt;
                          &lt;div class="custom-select"&gt;
                              &lt;span class="dropdown-arrow"&gt;&lt;/span&gt;
                              &lt;select th:field="${a.id}"&gt;
                                  &lt;option th:each="collaborator : ${allCollaborators}" th:value="${collaborator.id}" th:text="${collaborator.name}"&gt;Michael Pemulis&lt;/option&gt;
                              &lt;/select&gt;
                          &lt;/div&gt;
                      &lt;/li&gt;
  
                  &lt;/ul&gt;
                  &lt;div class="actions"&gt;
                      &lt;input type="submit" value="Save" class="button"/&gt;
                      &lt;a href="#" class="button button-secondary"&gt;Cancel&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>As you can see I want to let user choose for each role (roleNeeded) any collaborator from (allCollaborators) and keep that assigns in List (assignments).</p>
  
  <p>And I get error message: </p>
  
  <blockquote>
    <p>ava.lang.IllegalStateException: Neither BindingResult nor plain target
    object for bean name 'a' available as request attribute</p>
  </blockquote>
  
  <p>So question is: how to solve it, assign values from one array to another in template and retrieve that values in my controller.</p>