@PostMapping(value = "/list") @ResponseBody public void invoiceDetail2(String ids) { JSONObject jsonobject = JSONObject.parseObject(ids); JSONArray jsonArray = JSONArray.parseArray(jsonobject.get("list1").toString()); List<String> list = jsonArray.toJavaList(String.class); } @PostMapping(value = "/list2") @ResponseBody public void list2(@RequestBody ScannerVo vo) { List<String> list = vo.getList1();// JSONArray jsonArray = JSONArray.parseArray(vo.getList1());// List<String> list = jsonArray.toJavaList(String.class); }
public class ScannerVo { private List list1; public List getList1() { return list1; } public void setList1(List list1) { this.list1 = list1; } public String getTest() { return test; } public void setTest(String test) { this.test = test; } private String test; }
var getInvoice = function (invoiceCode,invoiceNum) { var list1 = ["number","name"]; var param = {}; param["list1"] = list1; param["test"] ="java"; var json = JSON.stringify(param); $.ajax({ type: ‘POST‘, url: CTX + ‘/checkInvoice/list2‘, data: json, dataType: "json", async:false, contentType: ‘application/json‘, success: function(data){ if(data.success) { value = ‘success‘; $("#table").bootstrapTable(‘refresh‘); } else { value = ‘fail‘; } showAlertFrame(value, data.message); }, error: function (e) { } }); };
原文地址:https://www.cnblogs.com/dand/p/10031854.html
时间: 2024-10-05 04:10:15