title: Get checkbox values as array from HTML form in spring
body: <p>I have a form that displays all the items in my list. There is a checkbox next to each element:</p>
  <pre><code>&lt;input type=&quot;checkbox&quot; name=&quot;selected&quot; value=&quot;${product.id}&quot;&gt;
  </code></pre>
  <p>After I click the Continue button, I get into a controller where I want to have a list of all the checkboxes selected. I tried to do it like this:</p>
  <pre><code>@GetMapping
      public String getOrderForm(Model model, @RequestParam(value = &quot;selected&quot;) String[] selected){
  </code></pre>
  <p>But I am getting the error that there is no such object. How can I get this checkbox list?</p>