前端JS代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
重点注意:将对象数组转为JSON形式的字符串:JSON.stringify
后端获取:
1 2 |
|
JSONArray outListarray = JSONArray.fromObject(outListstr);
JSONArray inListarray = JSONArray.fromObject(inListstr);
List inList = JSONArray.toList(inListarray);
List outList = JSONArray.toList(outListarray);
java 后端接收
JSONArray outListarray = JSONArray.fromObject(outListstr);
JSONArray inListarray = JSONArray.fromObject(inListstr);
ArrayList inList = (ArrayList) JSONArray.toList(inListarray);
ArrayList outList = (ArrayList) JSONArray.toList(outListarray);
js接收后台java 中List 转换为array()
if(customerChannelFlag) {
waf.doPost({
action: "targetterminal",
async: false,
data: {
_method: "entryChange",
cellnames: "SelectcustomerChannelFlag",
customerChannelFlag: customerChannelFlag,
customerId: customer.id,
materialId: material.id,
billID:_self.getCurrentModel().id,
row:rowText,
key:cellname,
adminOrgID: waf("#basedataDept").wafPromptBox("getValue")==null?"": waf("#basedataDept").wafPromptBox("getValue").id,
outList : JSON.stringify(outList),//输出参数
inList : JSON.stringify(inList) // 输入参数
},
success: function (data) {
console.log("判断目标终端库外,提交状态下,不同地区下存在相同目标终端+产品申请---------------");
console.log(data);
var flag = data.flag;
var org = data.org;
var person = data.person;
inList=eval(data.inList);
outList=eval(data.outList);
customerChannelFlag:data.customerChannelFlag;
if(flag=="false"){
_self.showWarning("checkRepeat","校验提醒","您添加的数据【"
+ customer.name.l2 + "/"
+ material.name.l2
+ "】已被其他区域定义过:【"
+ org.name.l2
+ "/" + person.name.l2
+ "】" );
}
}
});
}