引用:http://blog.163.com/zylzzyl_2002/blog/static/13993796720121119113946142/
引入jquery转化json的js
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.json-2.4.js"></script>
js文件中:
//定义js对象:
function userObject(name,age){
this.name = name;
this.age = age;
}
//提交对象数组
function submitObject{
var userArray = new Array();
var convertArray = new Array();
var ss = new userObject('skyliving',100);
convertArray.push(ss);
var params = 'userArray ='+$.toJSON(convertArray );
$.ajax({
type:'post',
url : XX.action,
data : params,
... ...
}
);
}
java接收对象数组
class User{
private String name;
pirvate int age;
....
}
class BussnisseClass{
private String convertArray;
//getter setter
public List<User> getUserList(){