java:
List list=new ArrayList(); list.add(new User("test")); //获取list
JSONObject json=JSONObject.fromObject(list); //list-->json的转化
sysout(json); //print [{"name":"test"}]
String content=json.toString; //toString并传递给jsp
response.getWriter().write(content);
----------------------------------------------
jsp:
jquery代码:
function callback(json){
alert("回调: "+json.name); //print test
}