- wdp
- 等级: 初级会员
- 性别:
- 文章: 26
- 积分: 50
- 来自: 厦门
|
我做一个表格,如果是从grade.jsp页面取数据就没有问题,如果是从getGradeGrid.asp页面取就会出错,提示:缺少 ';'
getGradeGrid.asp是我从grade.jsp转过来的,,我看了他们的输出都是一样的,为什么就会出错呢,,
gradeGrid.asp代码
js 代码
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>年级管理</title>
- <link rel="stylesheet" type="text/css" href="../ext/resources/css/ext-all.css" />
- <script type="text/javascript" src="../ext/adapter/ext/ext-base.js"></script>
- <script type="text/javascript" src="../ext/ext-all.js"></script>
- <script type="text/javascript">
-
- Ext.onReady(function(){
- Ext.BLANK_IMAGE_URL = '../ext/resources/images/default/s.gif';
- var store = new Ext.data.Store({
- proxy: new Ext.data.ScriptTagProxy({
- url: 'getGradeGrid.asp'
-
- }),
- reader: new Ext.data.JsonReader({
- root: 'teachers',
- totalProperty: 'counts',
- fields: ['gradeCode', 'gradeName']
- })
- });
- var cm = new Ext.grid.ColumnModel([{
- id: 'id',
- header: "年级代码",
- dataIndex: 'gradeCode',
- width: 420
- },{
- header: "年级名称",
- dataIndex: 'gradeName',
- width: 100
- }]);
-
- cm.defaultSortable = true;
- var grid = new Ext.grid.GridPanel({
-
- renderTo: document.body,
- width:700,
- height:500,
- title:'年级管理',
- store: store,
- cm: cm,
-
- sm: new Ext.grid.RowSelectionModel({selectRow:Ext.emptyFn}),
- loadMask: true,
-
-
- bbar: new Ext.PagingToolbar({
- pageSize: 25,
- store: store,
- displayInfo: true,
- displayMsg: ' 显示 {0} - {1} 条,共有 {2} 条',
- emptyMsg: "没有可以显示的数据"
- })
- });
- grid.render();
- store.load({params:{start:0, limit:25}});
- });
-
-
-
- </script>
-
- </head>
-
- <body>
- <div id="topic-grid"></div>
- </body>
- </html>
getGradeGrid.asp代码
js 代码
- <%
- Response.Charset="utf-8"
- Session.CodePage=65001
- 'dim boolean scriptTag = false
- dim scriptTag
- scriptTag = false
- dim cb
- cb = trim(request("callback"))
- 'response.write "cb=" & cb
- if cb = "" then
- scriptTag = true
- response.ContentType="text/javascript"
- else
- response.ContentType="application/x-json"
- end if
-
- if scriptTag then
- response.write cb & "("
- end if
- %>
-
- {
- "counts": "4",
- "teachers": [
- {
- "gradeCode": "9999006150000003",
- "gradeName": "\u533a\u7fe0\u7389"
- },
- {
- "gradeCode": "9999006150000005",
- "gradeName": "\u5218\u91d1\u9022"
- },
- {
- "gradeCode": "9999006150000008",
- "gradeName": "\u6881\u8d3a\u5f3a"
- },
- {
- "gradeCode": "9999006150000009",
- "gradeName": "\u5f20\u5065\u534e"
- }
- ]
- }
-
- <%
-
- if scriptTag then
- response.write ");"
- end if
- %>
grade.jsp代码
js 代码
- <%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" %>
- <%
- boolean scriptTag = false;
- String cb = request.getParameter("callback");
- if (cb != null) {
- scriptTag = true;
- response.setContentType("text/javascript");
- } else {
- response.setContentType("application/x-json");
- }
-
- if (scriptTag) {
- out.write(cb + "(");
- }
-
-
- %>
-
- {
- "counts": "4",
- "teachers": [
- {
- "gradeCode": "9999006150000003",
- "gradeName": "\u533a\u7fe0\u7389"
- },
- {
- "gradeCode": "9999006150000005",
- "gradeName": "\u5218\u91d1\u9022"
- },
- {
- "gradeCode": "9999006150000008",
- "gradeName": "\u6881\u8d3a\u5f3a"
- },
- {
- "gradeCode": "9999006150000009",
- "gradeName": "\u5f20\u5065\u534e"
- }
- ]
- }
-
- <%
-
- if (scriptTag) {
- out.write(");");
- }
- %>
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
返回顶楼 |
|
|
- wdp
- 等级: 初级会员
- 性别:
- 文章: 26
- 积分: 50
- 来自: 厦门
|
问题以解决
if cb = "" then
改成
if cb <> "" then
即可,,太不小心了,
|
返回顶楼 |
|
|