liaobin9288
2012-03-09 17:19 阅读 404
已采纳

extjs Ext.grid.GridPanel组件使用时不显示数据

一.extjs grid 页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">





二.提供json数据页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    works001 works001 2012-03-10 12:32

    你的data.jsp变为
    [code="java"]<%
    String start = request.getParameter("start");
    String limit = request.getParameter("limit");
    try {
    int index = Integer.parseInt(start);
    int pageSize = Integer.parseInt(limit);

    String json = "{totalProperty:100,root:[";
    for (int i = index; i < pageSize + index; i++) {
        json += "{id:" + i + ",name:'name" + i + "',descn:'descn" + i + "'}";
        if (i != pageSize + index - 1) {
            json += ",";
        }
    }
    json += "]}";
    response.getWriter().write(json);
    

    } catch(Exception ex) {
    }
    %>
    [/code] 就有数据了

    点赞 评论 复制链接分享
  • works001 works001 2012-03-12 11:59

    代码我是在myeclipse 然后部署到服务器上运行的 你的是?

    点赞 评论 复制链接分享

相关推荐