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个回答

你的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] 就有数据了

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!