formdata 表单提交list方法

后台对象

public class test { private String name; private List test1List; private Test2 test2; get、set省略....... }

【formdata 表单提交list方法】formdata 前端传list和对象方式
var form = new FormData(); form.append("name", "test"); form.append("test1List[0].属性", "值"); form.append("test1List[0].属性", "值"); form.append("test1List[1].属性", "值"); form.append("test1List[1].属性", "值"); form.append("test2.属性",'值"); form.append("test2.属性",'值"); var settings = { "async": true, "crossDomain": true, "url": "后台地址", "method": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded", "cache-control": "no-cache", "Postman-Token": "8738909b-5477-49fa-8519-c7cdbe7274fd" }, "processData": false, "contentType": false, "mimeType": "multipart/form-data", "data": form }$.ajax(settings).done(function (response) { console.log(response); });

    推荐阅读