AJAX 请求返回存放list的map

@RequestMapping(value="/csg/objection/getObjRt.shtml")
	@LayOuts(checklogin=PageType.checkloginval,page=PageType.JSON,desc = "", viewpage = "")
	public Map<String, Object> getObjRt(HttpServletRequest request,HttpServletResponse response,ResBean handler)throws Exception{
		ResultMap<String,Object> resultMap = new ResultMap<String,Object>();
		try{
			long obj_type = ParamUtil.getParameterLong(request, "obj_type",-1);
			long busi_id = ParamUtil.getParameterLong(request, "busi_id",1);
			long phase_id = ParamUtil.getParameterLong(request, "phase_id",1);
			
			if(obj_type <0){
				throw new AppException("没有获取到obj_type!");
			}
			ResultMap<String,Object> where = new ResultMap<String,Object>();
			where.put("obj_type", obj_type);
			where.put("busi_id", busi_id);
			where.put("phase_id", phase_id);
			where.put("domain_no", getDomainNo(request));
			
			List<ResultMap<String, Object>> queryObjectionResult = objectionTotalService.queryObjectionResult(where);
			resultMap.put("objectionResult", queryObjectionResult);
			resultMap.put("success", true);
			resultMap.put("msg", "拒绝异议成功!");
		}catch(AppException e){
			resultMap.put("error", true);
			resultMap.put("msg", "拒绝异议失败!");
			logger.error("拒绝异议失败",e);
		}catch(Exception e){
			resultMap.put("error", true);
			resultMap.put("msg", "拒绝异议失败!");
			logger.error("系统错误",e);
		}
		return resultMap;
	}


IO({  //
					data : {
						obj_type : obj_type,
						phase_id : 1
					},
					url : requestpix+'/csg/objection/getObjRt.shtml',
					success : function(result){
						var objectionResult= JSON.parse(result).objectionresult;
						for(var i=0;i<objectionResult.length;i++){
							alert(objectionResult[i].status);
						}
					}
				});


猜你喜欢

转载自blog.csdn.net/hnkuo/article/details/52996408