前台:
var rows = $('#mygrid').datagrid("getRows");
$.post(
sunny.contextPath + '/dutyManage/addMonthDutyIntoDB.do',
{
data:JSON.stringify(rows)
}, function(result) {
var success=result.success;
if(success){
}else{
$.messager.progress('close');
$.messager.alert('系统提示','<font size=\"2\" color=\"#666666\"><strong>'+result.info+'</strong></font>',
'warningSunnyIcon',function(){
parent.$('#monthDutyAddDialogId').dialog('close');
});
return;
}
},
'json'
);
后台:
@RequestMapping(value="/addMonthDutyIntoDB",method=RequestMethod.POST)
public @ResponseBody Map<String, Object> addMonthDutyIntoDB(
@RequestParam(required=false,value="data")String data,
@RequestParam(required=false,value="unitId")Integer unitId,
@RequestParam(required=false,value="normalFlag")Integer normalFlag
){
net.sf.json.JSONArray jsonArray=net.sf.json.JSONArray.fromObject(data);
List<Duty> dutyList=jsonArray.toList(jsonArray, Duty.class);
Map<String, Object> map=new HashMap<String, Object>();
if (null!=map) {
map.put("success", true);
} else {
map.put("success", false);
}
return map;
}