title: Pass Map value to Spring MVC controller using <form:hidden>
body: <p>On submitting the page, i need to do some process and send some data to the controller. I felt the 'Map' suits for my requirement to pass in the data. Here is what i am doing:</p>
  
  <h2>JSP:</h2>
  
  <pre><code>&lt;form:hidden id="passMapData" path="passMapData"/&gt;
  </code></pre>
  
  <h2>Controller:</h2>
  
  <pre><code>@RequestMapping(value = "/newPage/testData", method = RequestMethod.POST)
  public String newPageTestData(@Valid @ModelAttribute("npf") NewPageForm npf, BindingResult result, Model model) {
  
  }
  </code></pre>
  
  <h2>NewPageForm.java:</h2>
  
  <pre><code>public class NewPageForm {
    private Map&lt;String, String&gt; passMapData = null;
  
    public Map&lt;String, String&gt; getPassMapData() {
      return passMapData;
    }
  
    public void setPassMapData(Map&lt;String, String&gt; passMapData) {
      this.passMapData = passMapData;
    }
  }
  </code></pre>
  
  <h2>Issue:</h2>
  
  <p>On submitting the form, the BindingResult in the controller is showing error "IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map]"</p>
  
  <p>Cant we pass a Map type to controller in form submit?</p>