If anyone is still struggling with that, this is how it should be done:
Form inputs:
<input name="myParam" value="1"/>
<input name="myParam" value="4"/>
<input name="myParam" value="19"/>
Controller method:
@RequestMapping
public String deletePlaces(@RequestParam("myParam") Long[] myParams) {
//myParams will have 3 elements with values 1,4 and 19
}
This works the same for String[] Integer[] Long[] and probably more. POST,GET,DELETE will work the same way.
Parameter name must match name tag from form input. No extra [] needed etc. In fact, param name can be ommited, if method argument name is the same as input name so we can end up with method signature like this:
@RequestMapping
public String deletePlaces(@RequestParam Long[] myParams)
and it will still work
Something extra:
Now if you have domain model lets say Place and you have PlaceRepository, by providing Place#id as value of your inputs, Spring can lookup related objects for us. So if we assume that form inputs above contais User ids as values, then we can simply write this into controller:
public String deletePlaces(@RequestParam Place[] places) {
//places will be populated with related entries from database!
}
Sweet isn't it?