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";
}

  

上一篇:PHP基础知识之常量


下一篇:解决解决httpd: Could not reliably determine the server's fully qualified domain name