springboot form 提交集合 list
前端代码:
function btnSubmit(data) { var url = $('form').attr("action"); $.ajax({ url: url, type: 'post', datatype: "json", contentType: "application/json; charset=utf-8", data: JSON.stringify([{"name": "0a1", "number": "1", "price": "1", "price": "1"}]), success: function (s) { //询问框 layer.alert('数据保存成功!', { icon: 1, skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则,去这里查阅 }, function () { layer_close() windowReLoad(); }) }, error: function (e) { alert(e.responseText); } })
后台节后
@ResponseBody @PostMapping("/add") public String addBill(@RequestBody List< BillDetails> billDto) { System.out.println("orders size:" + billDto.size()); /*entity.setIsdelete(false); entity.setId(0); billService.addBill(entity);*/ return "admin/bill/add"; }
文章属于个人工作备忘录,欢迎指正...