public class DataModel{
public String id = null;
public String name = null;
public String content = null;
}
public class PageBean {
public int rownumber = 0;
public int pagecount = 0;
public int pageindex = 0;
}
/**
*如你既要List又要 PageBean 那么你得这么返回
* 定义一个新类
*/
public class JsonBean {
public List datas;
public PageBean page;
}
//生成的json传格式是
{
page:{
rownumber:1,
pagecount:1,
pageindex:1
},
datas:[
{id:"",name:"",content:""},
{id:"",name:"",content:""},
{id:"",name:"",content:""}
]
}
//然后在前台,你使用
var strData = xmlRequest.responseText;
if(typeof strData !== "object")
strData = eval('('+strData+')');
//然后,数据信息通过
var dataArray = strData.datas;
//分页信息对象
var pageObj = strData.page;
//想要获取page中的值
var pageindex = pageObj.pageindex;
//....其他的就不多描述