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"]}]} 展开
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"]}]} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询