首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

ScriptTagProxy与jsp后盾交互实例

2012-08-28 
ScriptTagProxy与jsp后台交互实例ScriptTagProxy与jsp后台交互实例----jsExt.onReady(function(){var per

ScriptTagProxy与jsp后台交互实例
ScriptTagProxy与jsp后台交互实例
---->js

Ext.onReady(function(){var personRecord = new Ext.data.Record.create([{name:"name",type:"string"},{name:"sex",type:"string"}])var pDate = new personRecord({name:"steven",sex:"boy"});var store = new Ext.data.Store({//proxy:new Ext.data.HttpProxy({url:"http://localhost:8080/extTest/data.jsp"}),proxy:new Ext.data.ScriptTagProxy({url:"http://192.188.60.97:8080/extTest/data.jsp"}),reader: new Ext.data.ArrayReader({},personRecord)}) store.load();     var grid = new Ext.grid.GridPanel({        store: store,        columns: [            {header: 'name', dataIndex: 'name'},            {header: 'sex', dataInex: 'sex'}        ],        autoHeight: true,        renderTo: 'grid'    });    });


------>jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"    pageEncoding="ISO-8859-1"%><%boolean flag = false;String cbStr = request.getParameter("callback");if(cbStr != null){flag = true;response.setContentType("text/javascript");out.print(cbStr+"(");}else{response.setContentType("application/x-json");}out.print("[" +           "['jim','boy']," +           "['tom','boy']," +           "['kit','girl']" +           "]");if(flag){out.print(");");}System.out.println(cbStr);%>



注意:out.print(cbStr+"(");一定要返回cbStr,否则不会出结果。

热点排行