title: Spring Thymeleaf pass map to form
body: <p>I have a Properties hashmap, that i pass to my form in settings.html:</p>
  
  <pre><code>&lt;form action="#" th:action="@{/settings/modify}" method="post" th:object="${properties}"&gt;
      &lt;div th:each="property : ${properties}"&gt;
          &lt;div class="form-group"&gt;
                      &lt;label th:for="${property.key}" name="key" th:text="${property.key}"&gt;Property&lt;/label&gt;
                      &lt;input type="text"
                             class="form-control"
                             name="value"
                             th:id="${property.key}"
                             th:value="${property.value}" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-default" name="action" value="save"&gt;Submit&lt;/button&gt;
      &lt;button type="reset" class="btn btn-default" name="action" value="reload"&gt;Reset&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The general idea is to show the properties, that can be saved and passed back to controller SettingsController:</p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/settings")
  public class SettingsController {
  
      @Autowired
      SettingsService settingsService;
  
      @Value("${postgres-bin-dir}")
      private String pgDirectory;
  
      @GetMapping(value = "/current")
      public String currentSettings(Model model) {
  
      Map&lt;String, String&gt; propertiesMap = settingsService.getSettingsMap();
  
      model.addAttribute("pgpath", pgDirectory);
      model.addAttribute("properties", propertiesMap);
      model.addAttribute("title", String.format("Current PgBackupper'a settings(%d)", propertiesMap.size()));
      return "settings/settings";
  }
  
      @PostMapping(value = "/modify", params = "action=save")
      public String changeProperties(
          @RequestParam(value = "properties") Map&lt;String, String&gt; properties,
          RedirectAttributes redirectAttributes){
  
      redirectAttributes.addFlashAttribute("message","Settings changed succesfully");
      return "redirect:/settings/current";
  }
  </code></pre>
  
  <p>}</p>
  
  <p>So I want to get my post method "modifyProperties()" work, bunt i can't send changed parameters back.</p>
  
  <p>As it is mentionet at <a href="http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#iterable-values" rel="nofollow noreferrer">official doc</a>, I've tried to use such a th:field method, like, and used Entry set for looping:</p>
  
  <pre><code>&lt;div th:each="property : ${properties.entrySet()}"&gt;
      &lt;div class="form-group"&gt;
                  &lt;label th:for="${property.key}" name="key" th:text="${property.key}"&gt;Property&lt;/label&gt;
                  &lt;input type="text"
                         class="form-control"
                         name="value"
                         th:id="${property.key}"
                         th:value="${property.value}" 
                         th:field="*{property.get(${property.key})}" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>All my attempts fail with an error:</p>
  
  <pre><code>Whitelabel Error Page
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  
  Sun Mar 04 14:07:42 MSK 2018
  There was an unexpected error (type=Internal Server Error, status=500).
  Error during execution of processor 
  'org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor' (settings/settings:29)
  </code></pre>
  
  <p>What do I do wrong?</p>