Spring mvc can support List<Object>
, Set<Object>
and Map<Object>
param, but without @RequestParam.
Take List<Object>
as example, if your object is User.java
, and it like this:
public class User {
private String name;
private int age;
// getter and setter
}
And you want pass a param of List<User>
, you can use url like this
http://127.0.0.1:8080/list?users[0].name=Alice&users[0].age=26&users[1].name=Bob&users[1].age=16
Remember to encode the url, the url after encoded is like this:
http://127.0.0.1:8080/list?users%5B0%5D.name=Alice&users%5B0%5D.age=26&users%5B1%5D.name=Bob&users%5B1%5D.age=16
Example of List<Object>
, Set<Object>
and Map<Object>
is displayed in my github.