spring接收对象数组实例

时间:2014-06-18 00:45:17   收藏:0   阅读:505

JS

var param= new Array();
var one= new Object;
one.id = ‘1‘;
one.name= ‘simba1‘;
param.push(one);

var two= new Object;
two.id = ‘2‘;
two.name= ‘simba2‘;
param.push(two);

$.ajax({
async : false,
cache : false,
type : ‘POST‘,
dataType:"json",      
            contentType:‘application/json;charset=UTF-8‘,
url : ‘test.htm‘,
data : JSON.stringify(param),
error : function(data) {
  alert("加载数据错误,请重试!");
   },
success : function(data) {

}
});


JAVA

POJO

public class Test{

public Long Id;

public String name;

get***

set**

}



controller

@RequestMapping(value = "test.thm", method = RequestMethod.POST)
    @ResponseBody
    public Boolean editQhbPrizeChance(@RequestBody Test[] test) {

}

spring接收对象数组实例,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!