skykkkkkjj 2010-06-09 10:28
浏览 230
已采纳

Extjs登录出错,大家帮忙看看。

我们公司因为项目需要想把界面弄成ExtJs的。我以前也没学过,临时弄了点例子,结果发现问题了,我用的是Struts2 Spring Hibernate Mysql

private boolean success;
private String message;
private String username;
private String password;
private String randCode;
private DefaultService ds;
public String execute() throws Exception{
if(username.equals("username")){
this.success = true;
this.message="你的账号是:"+username+"密码为:"+password;
}else{
this.success=false;
this.message="您输入的用户不能登陆系统";
}

return SUCCESS;
}

public String getMessage() {
    return message;
}

public void setMessage(String message) {
    this.message = message;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

public String getRandCode() {
    return randCode;
}

public void setRandCode(String randCode) {
    this.randCode = randCode;
}

public boolean isSuccess() {
    return success;
}

public void setSuccess(boolean success) {
    this.success = success;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public DefaultService getDs() {
    return ds;
}

public void setDs(DefaultService ds) {
    this.ds = ds;
}

login : function() {
this.fp.form.submit({
waitMsg : "正在登陆......",
url : "./Login.action",
success : function(form, action) {
window.location.href = "";
},
failure : function(form, action) {
form.reset();
if(action.failureType == "connect"){
Ext.Meg.alert("服务器指定的路径链接不上");
}
if (action.failureType == Ext.form.Action.SERVER_INVALID) {
Ext.MessageBox
.alert("警告", action.result.errors.msg);
}else{
Ext.MessageBox
.alert("登陆失败", action.result.message);
}
}
}
);
}

每次返回的failureType 只要注入了ds就返回 "connect" , 如果不注入就能正常传递。

  • 写回答

2条回答 默认 最新

  • upup1000 2010-06-09 11:24
    关注

    api上写着,这个错误,可以通过response获取更详细的信息

    你可以试着打印一下 action.response.responseText

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考