Ext.onReady(function(){ //使用表单提示 Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = "side"; //定义一个输入表单 var simple = new Ext.FormPanel({ labelWidth:40, baseCls:"x-plain", defaultType:"textfield", defaults:{width:180}, items:[{ fieldLabel:"帐号", name:"user.username", allowBlank:false, blankText:"帐号不能为空" },{ inputType:"password", fieldLabel:"密码", name:"user.password", allowBlank:false, blankText:"密码不能为空" }], buttons:[{ text:"提交", type:"submit", handler:function(){ if(simple.form.isValid()){ Ext.MessageBox.show({ title:"请稍等", msg:"正在加载.....", progressText:"", width:300, progress:true, closable:false, animEl:"loding" }); var f = function(v) { return function(){ var i = v / 11; Ext.MessageBox.updateProgress(i, ''); } } for(var i = 1; i < 13; i++) { setTimeout(f(i), i * 150); } //提交到服务器操作 simple.form.doAction("submit",{ url:"http://localhost:8080/extjs/Login.action", method:"post", params:"", success:function(form, action){ document.location='user/index.jsp'; Ext.Msg.alert("登录成功!",action.result.message); }, failure:function(form, action){ Ext.Msg.alert('登陆失败', action.result.message); } }); } } },{ text:"重置", handler:function(){ //重置表单 simple.form.reset(); } }] }); //定义窗体 var _window = new Ext.Window({ title:"登录窗口", layout:"fit", width:280, height:150, plain:true, bodyStyle:"padding:10px;", maximizable:false, closeAction:"close", closable:false, collapsible:true, plain:true, buttonAlign:"center", items:simple }); _window.show(); });
xml文件咋写的
simple.form.doAction("submit",{
url:"Login.action",
可能是Login.action返回的数据不对,你打出来看看是什么?