日期:2014-05-16 浏览次数:20418 次
Ext.onReady(function(){
???
??? var INDEX = Ext.data.Record.create([
??? ??? {name:"userName",type:"string",mapping:"userName"},
??? ??? {name:"password",type:"string",mapping:"password"},
??? ??? {name:"dayx",type:"string",mapping:"dayx"},
??? ??? {name:"sexGroup",type:"string",mapping:"sexGroup"}
??? ]);
???
??? var reader = new Ext.data.JsonReader({},INDEX);
???
???
???
??? var form = new Ext.form.FormPanel({
???
??? ??? title:"用户注册",
??? ??? width:300,
??? ??? autoHeight:true,
??? ??? frame:true,
??? ??? renderTo:Ext.getBody(),
??? ??? labelWidth:65,
??? ??? labelAligh:"center",
??? ??? defaultType:"textfield",
??? ???
??? ??? items:[
??? ??? {
??? ??? ??? name:"userName",
??? ??? ??? fieldLabel:"用户名",
??? ??? ??? width:200
??? ??? },{
??? ??? ??? name:"password",
??? ??? ??? fieldLabel:"用户密码",
??? ??? ??? width:200
??? ??? },{
??? ??? ??? name:"dayx",
??? ??? ??? fieldLabel:"生日",
??? ??? ??? xtype:"datefield",
??? ??? ??? format:"Y-m-d",
??? ??? ??? width:150
??? ??? },{
??? ??? ??? name:"sexGroup",
??? ??? ??? fieldLabel:"性别",
??? ??? ??? xtype:"radiogroup",
??? ??? ??? width:100,
??? ??? ??? items:[{
??? ??? ??? ?? name:"sex",
??? ??? ??? ?? xtype:"radio",
??? ??? ??? ?? boxLabel:"男",
??? ??? ??? ?? inputValue:"男"
??? ??? ??? },{
??? ??? ??? ?? name:"sex",
??? ??? ??? ?? xtype:"radio",
??? ??? ??? ?? boxLabel:"女",
??? ??? ??? ?? inputValue:"女"
??? ??? ??? }]
??? ??? }
??? ??? ],
??? ??? buttons:[{
??? ??? ? text:"提交"
??? ??? },{
??? ??? ? text:"本地读取",
??? ??? ? handler:function(){
??? ??? ? ??? var json = {userName:"xxx",password:"111",dayx:"1999-09-09",sexGroup:"女"};
??? ??? ? ??? form.getForm().setValues(json);
??? ??? ? }
??? ??? },{
??? ??? ? text:"远程读取",
??? ??? ? handler:function(){
??? ??? ? ??? alert("1");
??? ??? ??? form.getForm().reader = reader;
??? ??? ??? alert("2");
??? ??? ??? form.load({
??? ?????????? url:"RemoteServlet.do",
??? ?????????? method:"get"
??? ??? ??? })
??? ??? ??? alert("3");
??? ??? ? }
??? ??? }]
??? ???
??? })
})
?
servlet:
?
?
??? ??? System.out.println("+++++++");
??? ??? response.setContentType("text/html;charset=utf-8");
??? ??? PrintWriter out = response.getWriter();
//??? ??? String start = request.getParameter("start");
//??? ??? String limit = request.getParameter("limit");
??? ?? // int start = Integer.parseInt(request.getParameter("start"));
??? ??? //int limit = Integer.parseInt(request.getParameter("limit"));
??? ?? // System.out.println("**"+start+"**"+limit);
??? ???
??? ??? String json = "[{userName:'ddd',password:'123',dayx:'1987-09-09',sexGroup:'男'}]";
??? ??? System.out.println(json);
??? ??? out.println(json);
??? ??? out.flush();
??? ??? out.close();