I have a very similiar problem solved in this thread: click
To make a long story short:
I'm generating form elements dynamically with jQuery and in the result it looks like this:
<div id="XYZ-1">
<input type="text" id="XYZ-1-position" name="XYZ-1-position" style="width: 20px;"/>
<input type="text" id="XYZ-1-input" name="XYZ-1-value" style="width: 400px;"/>
</div>
<div id="XYZ-2">
<input type="text" id="XYZ-2-position" name="XYZ-2-position" style="width: 20px;"/>
<input type="text" id="XYZ-2-input" name="XYZ-2-value" style="width: 400px;"/>
</div>
So for handling one form field, I'm using just this simple @ReqeustParam:
@RequestMapping(value = "/data", method = RequestMethod.POST)
public String myHandler(@RequestParam("XYZ-1-value")String content, Model model) {
model.addAttribute("dataset", content);
return "data"
In the Thread of the beginning of my post it is solved like:
public String controllerMethod(@RequestParam(value="myParam[]") String[] myParams){
....
}
And this works for input types with the same name:
<input type="checkbox" name="myParam[]" value="myVal1" />
<input type="checkbox" name="myParam[]" value="myVal2" />
But the difference to my problem is, that my form elements do NOT have the same name - each has an individual Name.
So my question is how I can handle these individual post-parameters in a single handler in my controller.
Thanks in advance