springMvc先端はjson方式でバックグラウンドに対象配列方法を伝えます。
以下の通りです
JSP
var vipFee= new Array;
//
$("#feeList :checkbox:checked").each(function(i){
vipFee.push({"enterpriseSeq":$(this).attr("enterpriseSeq"),"merchNo":$(this).val(),"serviceFee":$(this).attr("fqbFee")});
});
//
$.ajax({
type:"POST",
url: "addVipFeeList",
async:false,
dataType:"json",
contentType:"application/json", //
data:JSON.stringify(vipFee),
success:function(data){
//
if(data.success===true){
$("#feeList :checkbox:checked").each(function(i){
var FQBFee = parseFloat($(this).parent().siblings("td").find("input[name='fqbFee']").val());
$(this).parent().siblings("td").find("input").attr("readonly","readonly");
$(this).parent().siblings("td").find("input[name='fqbFee']").val(FQBFee.toFixed(3));
// “ ”,
$(this).parent().siblings("td").find("a[id='cancelA']").show();
// “ ”
$(this).parent().siblings("td").find("a[id='relateA']").hide();
//
$(this).prop("checked", false);
});
}
}
});
Controller
@RequestMapping(value = Constants.ADMIN + "/addVipFeeList",method=RequestMethod.POST)
@ResponseBody
public Map<String,Object> addVipFeeList(@RequestBody List<VipFee> vipFee){
Map<String,Object> map=new HashMap<String,Object>();
try {
//
if (vipFee!=null&&vipFee.size()>0) {
//
for (VipFee v:vipFee) {
v.setReplacePrdId(Constants.PRODUCT_TYPE_FQB);
}
}
//
vipFeeService.addVipFeeList(vipFee);
map.put("success", true);
} catch (CoreException e) {
map.put("success", false);
log.error(e.getCode(),e);
map.put("errorMsg", e.getCode());
}
return map;
}
以上のspringMvcフロントエンドはjson方式でバックグランドに相手の配列方法を伝えます。つまり、小编は皆さんに全部の内容を共有します。