1.使用一个Map<String, String>接收数据
When you request a Map
annotated with @RequestParam
Spring creates a map containing all request parameter name/value pairs. If there are two pairs with the same name, then only one can be in the map. So it's essentially a Map<String, String>
You can access all parameters through a MultiValueMap
:
public String processGetRequest(@RequestParam MultiValueMap parameters) {
This map is essentially a Map<String, List<String>>
. So parameters with the same name would be in the same list.
2.