前端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 });
後端接收:ajax
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 }
參考文獻:spring MVC 前臺傳數組類型,後臺用list類型接收也是能夠的spring