- 注册时间
- 2012-10-25
- 最后登录
- 2012-10-26
- 阅读权限
- 10
- 积分
- 15
- 精华
- 0
- 帖子
- 5
|
我在前端表格url指定为struts的一个action(指定无误。已经执行到后台action),进入表格界面的时候报错:DataGrid json is error。action代码如下:(执行正常)
HttpServletResponse response = ServletActionContext.getResponse();
PrintWriter out = response.getWriter();
ArrayList dataAll = (ArrayList) this.service.findAll();
HashMap result = new HashMap();
result.put("data", dataAll);
result.put("total", new Integer(dataAll.size()));
result.put("minAge","10");
result.put("maxAge", "20");
result.put("avgAge", "15");
String json = PluSoft.Utils.JSON.Encode(result);
response.getWriter().write(json);
map = (Map) ActionContext.getContext().get("request");
map.put("list", json);;
System.err.println("json"+json);
打出的json格式:json{"total":8,"maxAge":"20","minAge":"10","data":[{"age":2,"class":"com.test.bean.Userinfo","firstname":"2","lastname":"2","userid":40avgAge":"15"}。
|
|