xupei1317_java 2008-12-06 14:04
浏览 184
已采纳

ext2.2分页出现脚本错误,等待受教!

脚本提示为:
行:11
字符:12246
代码:0
错误:系统错误: -1072896658。
网址:http://localhost:8088/Test/paging.jsp

源码为:
<%@ page language="java" pageEncoding="utf8"%>
<%
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:[\n";
for (int i = index; i < pageSize + index; i++) {
    json += "{id:" + i + ",name:'name" + i + "',descn:'descn" + i + "'}";
    if (i != pageSize + index - 1) {
        json += ",\n";
    }
}
json += "]}";
response.getWriter().write(json);
System.out.println(json);

} catch(Exception ex) {
}
%>



paging.jsp






<br> Ext.onReady(function(){<br> var cm = new Ext.grid.ColumnModel([<br> {header:&#39;编号&#39;,dataIndex:&#39;id&#39;},<br> {header:&#39;名称&#39;,dataIndex:&#39;name&#39;},<br> {header:&#39;描述&#39;,dataIndex:&#39;descn&#39;}<br> ]);</p> <pre><code>var ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url:&quot;paging.jsp&quot;}), reader: new Ext.data.JsonReader({totalProperty: &#39;totalProperty&#39;,root: &#39;root&#39;}, [ {name: &#39;id&#39;}, {name: &#39;name&#39;}, {name: &#39;descn&#39;} ]) }); var grid = new Ext.grid.GridPanel({ el: &#39;grid&#39;, ds: ds, cm: cm, tbar: new Ext.PagingToolbar({ pageSize: 5, store: ds, displayInfo: true, displayMsg: &#39;显示第 {0} 条到 {1} 条记录,一共 {2} 条&#39;, emptyMsg: &quot;没有记录&quot; }), bbar: new Ext.PagingToolbar({ pageSize: 5, store: ds, displayInfo: true, displayMsg: &#39;显示第 {0} 条到 {1} 条记录,一共 {2} 条&#39;, emptyMsg: &quot;没有记录&quot; }), height:250, width:600, title:&#39;Array Grid&#39; }); grid.render(); ds.load({params:{start:0,limit:10}}); </code></pre> <p>})<br>



请问怎么解决!!

  • 写回答

1条回答 默认 最新

  • nickevin 2008-12-06 20:30
    关注

    后台的数据格式如下:
    {
    "beans" : [{
    "name" : "3m Co.",
    "id" :1,
    "descn" : 'xxx'
    },{
    "name" : "Apple.",
    "id" :2,
    "descn" : 'yyy'
    }],
    count : 100
    }

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!