title: How to pass multiple values from the form to a controller using Spring MVC?
body: <p>I am working with Spring MVC pattern and I am trying to make a JSP file which is like this as of now - </p>
  
  <p>In the form, I have four rows, first row is just for labelling and other three rows I need to put my data in the text box. For example- for DC1, I will insert <code>numServers</code> value in the textbox, I will insert <code>ipaddress</code> value in the textbox and <code>hostname</code> value in the textbox.</p>
  
  <pre><code>&lt;form method="post" enctype="multipart/form-data"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;Datacenter Name&lt;/td&gt;
              &lt;td&gt;Number of Servers&lt;/td&gt;
              &lt;td&gt;IP Address(comma separated)&lt;/td&gt;
              &lt;td&gt;Host Name(comma separated)&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;label for="dc1"&gt;DC1&lt;/label&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt;             
              &lt;td&gt;&lt;input type="text" name="hostname"  size="60"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;label for="dc1"&gt;DC2&lt;/label&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt;             
              &lt;td&gt;&lt;input type="text" name="hostname"  size="60"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;label for="dc1"&gt;DC3&lt;/label&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="numservers" size="20"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="ipaddress" size="60"&gt;&lt;/td&gt;             
              &lt;td&gt;&lt;input type="text" name="hostname"  size="60"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
      &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Now I am supposed to read these values after hitting the submit button as I will be typing necessary values in the textbox. I am using <code>RequestMapping</code> in my below code - </p>
  
  <pre><code>@RequestMapping(value = "test", method = RequestMethod.GET)
  public HashMap&lt;String, String&gt; testRequest(@RequestParam MultiValueMap&lt;?, ?&gt; allRequestParams) {
  
  }
  </code></pre>
  
  <p>Initially, I was using <code>MultiValueMap</code> but I am not sure how my above input criteria will fit into this? In general, I am not sure how do I structure my input in the above method for the above use case so that I can extract all the values easily in the method?</p>
  
  <p>This is the first time I started working with Spring MVC so having some difficulties..</p>