spring MVCajax 传递list 到后台

tech2026-10-01  2

var data={}; for (var i = 0; i < 3; i++) { data['studentList[' + i +'].name']="A"+i; data['studentList[' + i +'].age']=i; } $.ajax({ url: "./save", cache: false, type:'post', data:data, success: function (result) { if (checkResult(result)) { swal("", "操作成功!", "success"); } } });

 

 

 

@RequestMapping(value = "/save", method = RequestMethod.POST) @ResponseBody public AjaxResult save(List<Student> studentList) { return new AjaxResult(); }

 

最新回复(0)