"Arrays" in @RequestParam
are used for binding several parameters of the same name:
phone=val1&phone=val2&phone=val3
-
public String method(@RequestParam(value="phone") String[] phoneArray){
....
}
You can then convert it into a list using Arrays.asList(..)
method
EDIT1:
As suggested by emdadul, latest version of spring can do like below as well:
public String method(@RequestParam(value="phone", required=false) List<String> phones){
....
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…