Angularjs + SpringMvc绑定List复杂参数

前端之家收集整理的这篇文章主要介绍了Angularjs + SpringMvc绑定List复杂参数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  • java
/**
	 * 删除购物车物资信息
	 * @param saveGouwcVo
	 * @return
	 */
	@RequestMapping(value="/deleteGouwc",method=RequestMethod.POST)
	public RestfulResponseBody deleteGouwc(@RequestBody SaveGouwcVo saveGouwcVo){
		try{
			cgGouwcService.deleteGouwc(saveGouwcVo);
			return setResponseEntity("操作成功!",Constants.ResponseResultFlag.SUCCESS,null);
		}catch (Exception e) {
			e.printStackTrace();
			return setResponseEntity("操作失败!",Constants.ResponseResultFlag.ERROR,null);
		}
	}

.....

    private List<CgGouwc> cgGouwc;

	public List<CgGouwc> getCgGouwc() {
		return cgGouwc;
	}

	public void setCgGouwc(List<CgGouwc> cgGouwc) {
		this.cgGouwc = cgGouwc;
	}
  • js
$scope.saveGouwcVo = {};
 $scope.cgGouwc = [{"gouwc_id":"2222","zhangh_id":"23232","ziydwz_id":"23232"},{"gouwc_id":"2222","ziydwz_id":"23232"}];
 $scope.saveGouwcVo.cgGouwc= $scope.cgGouwc;
 $http.post($rootScope.settings.shop + 'api/cgGouwc/deleteGouwc',$scope.saveGouwcVo
        ).success(function (response) {
            if (response.resultFlag) {
                layer.msg("操作成功!");
            }else{
                layer.msg(response.reason);
            }
        });
原文链接:https://www.f2er.com/springmvc/148129.html

猜你在找的SpringMVC相关文章