Ext服务器交互问题

js:
[code="java"]
Ext.onReady(function() {
var store = new Ext.data.JsonStore({
url : "student.ejf",
root : "result",
fields : ["id", "name", "sex", "email", {
name : "bornDate",
type : "date",
dateFormat : "Y-n-j"
}]
});
var colM = new Ext.grid.ColumnModel([{
header : "姓名",
dataIndex : "name",
sortable : true
},{
header : "性别",
dataIndex : "organization"
},{
header : "出生日期",
dataIndex : "bornDate",
width : 120
},{
header : "电子邮件",
dataIndex : "email",
sortable : true
}]);
var grid = new Ext.grid.EditorGridPanel({
renderTo : "hello1",
title : "学生基本信息管理",
height : 200,
width : 600,
cm : colM,
store : store,
autoExpandColumn : 3,
clicksToEdit : 1
});
});
[/code]
java:
[code="java"]
protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
doPost(arg0,arg1);
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("out============");
String json = "{results:[{id:1,name:'小王',email:'xiaowang@easyjf.com',sex:'男',bornDate:'1991-4-4'},{id:2,name:'小李',"+
"email:'xiaoli@easyjf.com',sex:'男',bornDate:'1992-5-6'},{id:3,name:'小兰',email:'xiaoxiao@easyjf.com',sex:'女',bornDate:'1993-3-7'}]}";
PrintWriter out = response.getWriter();
out.print(json);
out.close();
}
[/code]
Web.xml:
[code="java"]<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


action
cn.com.ext.ExtDemo2


action
*.ejf

[/code]
为何去不到数据?貌似根本就没有提交?初学ext,不懂为啥?还有json的数据可以这么写吗?

3个回答

那是请求地址。。你要store.load()下

store都没装载数据。。怎么会有数据么

网页开头设置个UTF-8么。

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