title: Spring Required List parameter 'tagArray[]' is not present
body: <p>A beginner spring guy's here. I need to pass data from spring jsp form to controller. The problem is that one of my object's property is Set and I have to pass array data to controller. I did it using jQuery.</p>
  
  <p>Fragment of jsp' code with form:</p>
  
  <pre><code>&lt;form:form action="savePost" method="post" commandName="blogpost"&gt;
                  &lt;tr&gt;&lt;td&gt;Title: &lt;/td&gt; &lt;td&gt;&lt;form:input path="title"/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td&gt;Content: &lt;/td&gt; &lt;td&gt;&lt;form:input path="content"/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td&gt;Author: &lt;/td&gt; &lt;td&gt;&lt;form:input path="author"/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td&gt;Tags: &lt;/td&gt; &lt;td&gt;&lt;form:input path="tags" id="tags"/&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="Blog post save"&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;/form:form&gt;
  </code></pre>
  
  <p>and my bean's code:</p>
  
  <pre><code>@Entity
  @Table(name="posts")
  public class BlogPost {
  
      @Id
      @Column(name = "id")
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long id;
  
      @Column(name="post_title")
      private String title;
  
      @Column(name="post_content")
      private String content;
  
      @Column(name="post_author", nullable = false)
      private String author;
  
      @OneToMany(mappedBy = "blogPost")
      private List&lt;Comment&gt; comments;
  
      @ManyToMany
      @JoinTable(name="BLOGPOST_TAG",
              joinColumns = {@JoinColumn(name = "POST_ID", referencedColumnName = "id")},
              inverseJoinColumns = {@JoinColumn(name= "TAG_ID", referencedColumnName = "id")})
      private Set&lt;Tag&gt; tags;
  
      public BlogPost(){}
  
      public BlogPost(String title, String content, String author) {
          this.title = title;
          this.content = content;
          this.author = author;
      }
  
      public BlogPost(String title, String content, String author, Set&lt;Tag&gt; tags) {
          this.title = title;
          this.content = content;
          this.author = author;
          this.tags = tags;
      }
  
      public BlogPost(long id, String title, String content, String author, Set&lt;Tag&gt; tags) {
          this.id = id;
          this.title = title;
          this.content = content;
          this.author = author;
          this.tags = tags;
      }
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  
      public String getAuthor() {
          return author;
      }
  
      public void setAuthor(String author) {
          this.author = author;
      }
  
      public List&lt;Comment&gt; getComments() {
          return comments;
      }
  
      public void setComments(List&lt;Comment&gt; comments) {
          this.comments = comments;
      }
  
      public String toString(){
          return "ID: "+getId()+", title: "+getTitle()+", content: "+getContent()+", author: "+getAuthor()+"\n";
      }
  
      public Set&lt;Tag&gt; getTags() {
          return tags;
      }
  
      public void setTags(Set&lt;Tag&gt; tags) {
          this.tags = tags;
      }
  }
  </code></pre>
  
  <p>second one:</p>
  
  <pre><code>@Entity
  @Table(name="tags")
  public class Tag {
  
      @Id
      @Column(name = "id")
      private long id;
  
      @Column(name="tag_content")
      private String content;
  
      @ManyToMany(mappedBy = "tags")
      private List&lt;BlogPost&gt; blogposts;
  
      public Tag(){}
  
      public Tag(String content){
          this.content = content;
      }
  
      public Tag(long id, String content) {this.id = id; this.content = content; }
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public String getContent() {
          return content;
      }
  
      public void setContent(String content) {
          this.content = content;
      }
  
  
      public List&lt;BlogPost&gt; getBlogposts() {
          return blogposts;
      }
  
      public void setBlogposts(List&lt;BlogPost&gt; blogposts) {
          this.blogposts = blogposts;
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  Controler's code:</p>
  
  <pre><code>@PostMapping(value = {"savePost","/updatePost"})
  public String createOrUpdatePostPOST (@Valid @ModelAttribute("blogpost") BlogPost blogpost,
                                        BindingResult bindingResult, HttpServletRequest request, Model model,
                                        @RequestParam(value="tagArray[]") List&lt;String&gt; myArray){
  
      //Loop to show data from jsp
      for (String tag : myArray){
          System.out.println(tag);
  
      }
  
      String mappingValue = request.getServletPath();
  
      blogPostValidator.validate(blogpost, bindingResult);
  
      List&lt;BlogPost&gt; listOfBlogPostsToGetLastindex = repo.findFirstByOrderByIdDesc();
  
      long newCommentId = listOfBlogPostsToGetLastindex.get(0).getId()+1;
  
      if (bindingResult.hasErrors()) {
  
          if (mappingValue.contains("/savePost")){
              model.addAttribute("status", 0);
  
              return EDIT_PAGE_VIEW;
          }
  
          else {
              model.addAttribute("status", 2);
  
              return EDIT_PAGE_VIEW;
          }
      }
  
      else{
  
          blogpost.setId(newCommentId);
          repo.save(utilityService.returnCapitalizedPostObject(blogpost));
  
          return "redirect:/create-or-update-success";
      }
  }
  </code></pre>
  
  <p>The problem now is that although I can see passed data using <code>System.out</code>, I get error <code>Required List parameter 'tagArray[]' is not present</code>. Any idea what am I doing wrong?</p>