extjs-SSH2交互-登录验证问题

thebee955998041 2011-12-30 03:10:46

Ext.onReady(function(){
// Ext.QuickTips.init();
var loginbuttons =[{

text:"登 陆",
type:"submit",
handler:function(){
var id = _loginPanel.ownerCt.findByType("textfield")[0].getValue(); //获得_loginPanel里面的表单里的值
var pwd = _loginPanel.ownerCt.findByType("textfield")[1].getValue();

_loginPanel.form.doAction('submit',{ ////////数据提交验证
url:'Check.action', ////////数据提交地址
method:'post', ///////数据提交方法
params:{id:id,pwd:pwd}, //////提交的数据是以键值对形式提交的
success:function(form,action){ //////////回调函数
//var messagestr=action.result.message;
//Ext.Msg.alert('失败','this ='+action.result.success);
if(action.result.success)
{
_loginWin.close();

}else{
Ext.Msg.alert('失败','登陆失败!请重新输入');
}
},

failure:function(){
Ext.Msg.alert('错误','服务器出现错误请稍后试!');
}

});
}
},{
text:"重置",
handler:function(){_loginPanel.form.reset();}
}];


var _loginPanel = new Ext.form.FormPanel({

width:240,
height:100,
labelWidth:55,
defaultType:"textfield",
defaults:{anchor:"100%"},
layout:"form",
baseCls:"x-plain",
style:"padding:10px 0 0 0",
items:[{
fieldLabel:"帐号",
name:"loginac.id"
},{
inputType:'password',
fieldLabel:"密码",
name:"loginac.pwd"
}]
});

var _loginWin = new Ext.Window({

title:"用户登陆window界面",
width:272,
height:150,
plain:true,
modal:true,
bodyStyle:"padding:7px",
closeAction:"close",
closable:false, //去掉关闭窗口的按钮
collapsible:true, //有一个向上收缩的按钮
items:_loginPanel,
buttons:loginbuttons

});
_loginWin.show();

});

<head>
<base href="<%=basePath%>">

<title>Shinih Web X-ERP</title>
<!-- include everything after the loading indicator -->
<script type="text/javascript" src="adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="ext-all-debug.js"></script>
<script type="text/javascript" src="docs/resources/TabCloseMenu.js"></script>

<script type="text/javascript" src="docs/resources/docs.js"></script>
<script type="text/javascript" src="docs/output/tree.js"></script>

<script type="text/javascript" src="login/login2.js"></script>

<link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="docs/resources/docs.css"></link>
<!-- <link rel="stylesheet" type="text/css" href="docs/resources/style.css"></link> -->

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


</head>


 <package name="default" extends="json-default" namespace="/">
<action name="Check" class="com.shinih.action.CheckAction">
<result name="success" type="json">
<param name="includeProperties">success,message</param>
</result>
<result name="error" type="json">/index.jsp</result>
</action>
</package>

public class CheckAction extends ActionSupport {

private static final long serialVersionUID = 1L;

public static long getSerialversionuid() {
return serialVersionUID;
}
private Loginac loginac;

private LoginacService loginacService;

private String message;

private boolean success;

public String execute() throws Exception {
boolean s=loginacService.checkin(loginac);
//System.out.println("checkaction的S="+s);
if(s){
System.out.println("成功登录");
this.success = true;//用于extjs返回成功与否的信息
this.message = "Checkin Success";
}else {
System.out.println("登录失败");
this.success=false;
this.message="No User";
}
System.out.println("message="+message+",success="+success);

return SUCCESS;

}


public Loginac getLoginac() {
return loginac;
}

public LoginacService getLoginacService() {
return loginacService;
}

public String getMessage() {
return message;
}

public boolean isSuccess() {
return success;
}

public void setLoginac(Loginac loginac) {
this.loginac = loginac;
}
public void setLoginacService(LoginacService loginacService) {
this.loginacService = loginacService;
}
public void setMessage(String message) {
this.message = message;
}

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

执行不到success:function(form,action){} 里的内容,
各位大侠,帮我看看问题出在哪?
...全文
216 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sdlyczl 2012-01-20
  • 打赏
  • 举报
回复
ip

nu
courageous08 2012-01-19
  • 打赏
  • 举报
回复
学习了 , 新年快乐
thebee955998041 2011-12-30
  • 打赏
  • 举报
回复
没人来接分?

52,792

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧