
您可以在js中更改您的Submitform函数
$('#submitForm').submit(function(e) { var frm = $('#submitForm'); e.preventDefault(); var data = {}; var dt=[]; var newdt = {}; var Form = this; $.each(this, function(i, v) { var input = $(v); if(data.hasOwnProperty("fkcl")) //mapped all dropdown values to fkcl and fkdiv inorder to use `TestDto` variables { if(data.hasOwnProperty("fkdiv")) { dt.push(data); data={}; } } data[input.attr("name")] = input.val(); delete data["undefined"]; }); newdt['list']=dt; alert(JSON.stringify(newdt)); $.ajax({ async : false, global : false, contentType : 'application/json; charset=utf-8', type : 'post', url : frm.attr('action'), data: JSON.stringify(newdt), success : function(callback) { window.location.reload(); }, error : function() { $(this).html("Error!"); } });@Controller
@RequestMapping(value = "/save", method = RequestMethod.POST) public void save(@RequestBody ClassDes testprof) { for (TestDto t : testprof.getList()) { serv.save(t); } return new "redirect:/testing"; }欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)