Thanks Ben_Leedham
That didn't work, but it pointed me in the right direction.
I was unable to find a way to bind a list directly:
Code:
public void test(@ModelAttribute("constraints") ArrayList<String> constraints){
btw, you can't use just List because Spring will complain that it can't initialize it.
but it works if I put a wrapper around it:
Code:
public void test(@ModelAttribute("constraints") Contraints constraints){
...
}
public static class Constraints {
private List<String> items = new ArrayList<String>();
public List<String> getItems() {
return items;
}
public void setItems(List<String> items) {
this.items = items;
}
}
The problem I found is that a List doesn't have a property that can be set. So the request parameter names aren't clear. When I use the Constraints object, the parameters become:
items[0], items[1], etc