Also the same problem that wasted me a lot of time in this record
Problem Description:
Ajax request Backend, SPRINGMVC receive parameter, parameter is an object, property has list
Workaround:
Js:
function Save () {var gifts = []; var rows = Detail.fngetnodes (); for (var i = 0; i < rows.length; i++) {var gift = {}; var row = Detail.fngetdata (Rows[i]); gift[' scode '] = Row.scode; gift[' smarkertvalue '] = row.smarkertvalue; gift[' cpcount '] = count? 1:count; Gifts.push (gift); } var params= {};//Parameter object params.templatename = $ (' #_tName '). Val (); Params.templatecode = $ (' #templateCode '). Val (); Params.infos = gifts; Send Ajax$.ajax ({URL: "/autoinsur/template/create.json", type: "POST", DataType: "JSON", Async:false, ContentType: ' Application/json;charset=utf-8 ', data:JSON.stringify (params), success:function (data) {if (Data.resultcode! = ' 0 ') {$.dopalert ("operation failed:" + data.resultmsg); }}, Error:function () {$.dopalert ("The system is busy, please retry later"); } });} Back-end controller code: @RequestMapping ("/template/create.json") @ResponseBodypublic Commonresult Create (@ Requestbody aigifttemplatequerydto dto) {return null;}
Ajax Request parameters Complex object list, backend SPRINGMVC receive parameters