日期:2014-05-17  浏览次数:20634 次

Extjs登陆验证问题,求救!若问题解决200分送上。
Java code

public String loginOn() throws IOException{
        String resultStr = SUCCESS;
         HttpServletResponse response = ServletActionContext.getResponse();
        response.getWriter().print("{success:true,msg:'登录成功!'}");
        return resultStr;
}
[code]
这是我action中这样写的。。
[code=JScript]login : function() {
        if (this.fp.form.isValid()) {
            this.fp.form.submit({
                waitTitle : '请稍候',
                waitMsg : '正在登录......',
                url : 'user/loginOn.action',
                success : function(form, action) {
                    Ext.Msg.alert('提示', action.result.msg);
                },
                failure : function(form, action) {
                    form.reset();
                    Ext.Msg.alert('警告', action.result.msg);
                }
            });
        }
    }
这是js中写的。。
输入密码登陆后,总等不到值 action.result.msg,有时候还会有脚本错误!
更奇怪的是:按照action的代码,每次都应该是成功的。应该走js中的success 函数,可是每次都走进failure。。。
请高手指点,,,我都纠结了一天办了。。不知道为什么。。。求救,,问题解决200分送上。。。



------解决方案--------------------
login : function() {
if (this.fp.form.isValid()) {
this.fp.form.submit({
waitTitle : '请稍候 ',
waitMsg : '正在登录...... ',
url : 'user/loginOn.action ',
success : function(response, action)
{
if( " " != response.responseText)
{
var json = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert( '提示 ', json.msg);
} },
failure : function(response, action) {
form.reset();
Ext.Msg.alert( '警告 ', '错误 ');
}
});
}
}

------解决方案--------------------
login : function() { 
if (this.fp.form.isValid()) { 
this.fp.form.submit({ 
waitTitle : '请稍候 ', 
waitMsg : '正在登录...... ', 
url : 'user/loginOn.action ', 
success : function(response, action)
{
if( " " != response.responseText) 

var json = Ext.util.JSON.decode(response.responseText); 
Ext.Msg.alert( '提示 ', json.msg); 
} }, 
failure : function(response, action) { 
form.reset(); 
Ext.Msg.alert( '警告 ', '错误 '); 

}); 



------解决方案--------------------
后台msg 有没有get set 方法
------解决方案--------------------
function login() {
if (formLogin.getForm().isValid()) {
formLogin.getForm().submit({
url : "loginjson/login.action",