title: How to send data from radio buttons to Controller with Thymeleaf
body: <p>I have got an easy <code>HTML</code> page where I am displaying few <code>radio buttons</code>:</p>
  
  <pre><code>&lt;form action="#" th:action="@{/processForm}" th:object="${priorities}"
    method="post"&gt;
    &lt;fieldset&gt;
      &lt;table style="width: 500px"&gt;
        &lt;tr th:each="item : ${chosen}"&gt;
          &lt;td&gt;
            &lt;div&gt;
              &lt;div&gt;
                &lt;label th:text="${item}"&gt;example&lt;/label&gt;
                &lt;input type="radio" th:name="${'priorities[' + item + ']'}" value="a" /&gt;A
                &lt;input type="radio" th:name="${'priorities[' + item + ']'}" value="b" /&gt;B
                &lt;input type="radio" th:name="${'priorities[' + item + ']'}" value="c" /&gt;C
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;button type="submit"
              class="btn btn-xs btn-primary margin10-right paddingNew"
              name="save"&gt;Calculate!&lt;/button&gt;
          &lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here you got what I can see:</p>
  
  <p><img src="https://i.stack.imgur.com/YaJxY.png" alt="radios"></p>
  
  <p>I would like to send this data to my controller, so I created one:</p>
  
  <pre><code>@RequestMapping(value = "/processForm", method = RequestMethod.POST)
  public String save(@ModelAttribute(value = "foo") ClusterParams foo,
  @ModelAttribute(value = "priorities") HashMap&lt;String, String&gt; priorities,
  final ModelMap m) throws ClassNotFoundException, IOException,
  InterruptedException {
  
      for (String s : priorities.keySet()) {
          System.out.println(s);
      }
  }
  </code></pre>
  
  <p>Here you can see my class Weights (<strong>removed</strong>):</p>
  
  <pre><code>public class Weights {
  
      Map&lt;String, String&gt; priorities = new HashMap&lt;String, String&gt;();
  
      public Map&lt;String, String&gt; getPriorities() {
          return priorities;
      }
  
      public void setPriorities(Map&lt;String, String&gt; priorities) {
          this.priorities = priorities;
      }
  
  }
  </code></pre>
  
  <p>but I have no idea how to set the values with thymeleaf. </p>
  
  <p>I would like to get a mapping:</p>
  
  <pre><code>camera -&gt; B
  video -&gt; C
  </code></pre>
  
  <p>Could you help me to do that? Of course it is my idea with creating a HashMap, if there is any other solution I will change it.</p>
  
  <p>Thank you in advance</p>