jqgrid问题,帮我看看我的格式有什么不对?

PrintWriterout=resp.getWriter();StringBuffersb=newStringBuffer();sb.append("{\"page\"... PrintWriter out = resp.getWriter();
StringBuffer sb = new StringBuffer();
sb.append("{\"page\" : " + page + ",\"total\" : " + totalRecord
+ ",\"records\" : " + totalPage + ",\"rows\" : [");
for (Menu menu : list) {
sb
.append(String
.format(
"{\"mid\": %s,\"name\":\"%s\",\"url\":\"%s\",\"target\":\"%s\",\"description\":\"%s\",\"parent\":\"%s\"},",
menu.getMid(), menu.getName(), menu
.getUrl(), menu.getTarget(),
menu.getDescription(), menu.getParent()));
}
if (!list.isEmpty()) {
sb.deleteCharAt(sb.length() - 1);
}
sb.append("]}");
// JSONObject json=new JSONObject();
// json.put("list", list);
// System.out.println(json);
// System.out.println(sb.toString());
// resp.getWriter().print(json.toString());
out.print(sb.toString());
我的格式是这样的,其它都没问题,就到最后一步输出到jqgrid里面的时候没有数据。请问这是为什么?
{"total" : 14,"page" : 1,"records" : 3,"rows" : [{"id":0,"cell":["mid": 1,"name":"首页","url":"/welcome.jsp","target":"mainFrame","description":"登录","parent":"0"]},{"id":1,"cell":["mid": 2,"name":"安全退出","url":"/logout.jsp","target":"_top","description":"安全退出","parent":"0"]},{"id":2,"cell":["mid": 3,"name":"部门管理","url":"","target":"mainFrame","description":"部门管理功能列表","parent":"0"]},{"id":3,"cell":["mid": 4,"name":"权限管理","url":"","target":"mainFrame","description":"权限管理功能列表","parent":"0"]},{"id":4,"cell":["mid": 5,"name":"新增部门","url":"/dept/deptadd.jsp","target":"mainFrame","description":"新增部门功能","parent":"3"]}]}
展开
 我来答
shenchaoliang
2012-06-16 · TA获得超过1163个赞
知道大有可为答主
回答量:810
采纳率:0%
帮助的人:1514万
展开全部
不要给代码,把最终返回客户端的数据发上来就可以了。而且发现代码中没有cell,格式应该是如下的{ "total": 3, "page": 1, "records": 3, "rows": [{"id":"1","cell":["1","2011-03-01"]},{"id":"2","cell":["2","2011-03-02"]},"id:":"3","cell":["3","2011-03-03"]}]}
来自:求助得到的回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式