目录

SpringBoot前端给后端传list

目录

SpringBoot前端给后端传list

前端JS

 1 var taskList = ["123","456"];
 2 var params = {
 3     taskList: taskList
 4 };
 5 
 6 $.ajax({
 7     type: "PUT",
 8     dataType: "json",
 9     url: "/client/update",
10     data: params,
11     success: function (msg) {
12     }
13 });

后端接收:

1 @RequestMapping(value = "/update", method = RequestMethod.PUT)
2 @ResponseBody
3 public JSONResult updateClient(Client client, @RequestParam(value = "taskList[]") List<String> taskList) {
4     logger.debug("Yufan taskList={}", taskList);
5     return JSONResult.ok();
6 }

参考文献:

转载于:https://www.cnblogs.com/yfzhou/p/9661994.html