js 前台向后台传送 List 集合

			var orderNosList = new Array();
			var rows = $("#dg_linkOrder").datagrid("getChecked");
			if(rows.length < 1){
				$('#error').dialog('open').dialog('center').dialog('setTitle', '错误提示');
				$('#error').text("请选择一条数据");
			}else  {
				for (var i = 0; i < rows.length; i++) {
					orderNosList[i] = rows[i].orderNo;
				}
				
				var params = {
						reserveOrderNoList:orderNosList
					 };
								
				$.ajax({
					url : api.LINK_ORDER_RESERVE_RETRY,
					data : JSON.stringify(params),
					type : 'POST',
					contentType: "application/json",
					dataType : 'json',
					success : function(res) {
						var str = '';
						$(res.reserveFlowList).each(function(i, obj){
							var responseCode = obj.responseCode;
							var orderNo = obj.reserveFlow.orderNo;
							if (responseCode == 0) {
								str += "订单号为"+ orderNo +"成功
"
; } else { str += "订单号为"+ orderNo + obj.responseMsg +"
"
} }); $('#error2').dialog('open').dialog('center').dialog('setTitle', '提示'); $('#error2').html(str); // 刷新列表 linkOrder.unfresh_LinkOrder(); } }); }

核心部分

var demo = new Object();
demo.name="1";
demo.id="2";
var demo2 = new Object();
demo2.name="1";
demo2.id="2";
 
var conditons = [];
conditons.push(demo);
conditons.push(demo2);
 
$(function(){
  $.ajax({
    type:'post',
    url:'/http/pss/demo', 
		contentType: "application/json",
    data:{name:"123",conditions:JSON.stringify(conditons)},
    dataType : 'json', 
    success:function(data){
      console.log(data);
    },
    error: function (XMLHttpRequest, textStatus, errorThrown){
      alert("error");
    }
  });
});

java 后端

@RequestMapping("/http/pss/reserveOrderRetry")
	@ResponseBody
	public Object reserveOrderRetry(@RequestParam("reserveOrderNoList")List<String> reserveOrderNoList) {
		return service.reserveOrderRetry(reserveOrderNoList);
	}
@RequestMapping("/http/pss/reserveOrderRetry")
	@ResponseBody
	public Object reserveOrderRetry(@RequestParam("conditions")List<Demo> conditions,
							        @RequestParam("name")String name) {
		
	}

你可能感兴趣的:(问题总结)