用过EXTJS的大神进来!
前台
//提交到服务器操作
form1.form.doAction('submit',{
url:'Login.action',
method:'post',
success:function(form,action){
document.location="index.jsp";
Ext.Msg.alert("登录成功!",action.result.message);
},
failure:function(form,action){
Ext.MessageBox.alert("提示", "登录异常");
}
});
后台 UserAction
@Override
public String execute() throws Exception {
if(userImpl.login(userInfo.getUserName(), userInfo.getPassWord()) != null){
this.success= true;
//this.message="你的账号是:"+user.getUsername()+"密码是:"+user.getPassword();
}else{
this.success=false;
this.message="对不起,未授权的用户不能登录改系统";
}
return SUCCESS;
}
struts
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.devMode" value="true" />
<constant name="struts.i18n.encoding" value="utf-8" />
<constant name="struts.action.extension" value="action,," />
<package name="extjs" extends="json-default" namespace="/">
<action name="Login" class="com.aaa.action.UserAction">
<result type="json"></result>
</action>
</package>
</struts>
报错 url:'Login.action',错误,请问url应该怎么写?