1.怎么将jsp页面的数据转换成json格式的数据呢?
怎么将jsp页面的数据转换成json格式的数据呢?
用ajax可以转换。jsp页面的最新个人站源码数据转换成json格式可以采用js来解析,bookList = new ArrayList<Books>JSONObject json = new JSONObjectjson.accumulate("bookList",桌面宠物游戏源码 bookList);
json.accumulate("pageNum", pageNum);
json.accumulate("totalPages", totalPages);
json.accumulate("totalNum", totalNum);
jsonObj = json.toString();
jsonObj = { "totalNum":5,"bookList":[{ "catGrade":null,"sourceCat":"xx","catProseries":"yy"}, { "catGrade":null,"sourceCat":"yy","catProseries":"xx"}],"totalPages":3,"pageNum":2}
function(data){ //回调函数
var json = eval("("+data+")"); //将数据转换成json类型var bookList = json.bookList ;
alert(bookList[0].catGrade);