I use struts2.1.8 and extjs3.2, I make a login page, if login
failed,it will alert a message and it will still stay this login page;
if it login success,it will go to another new page,such as main.jsp
page
My login page is follows:
var win=new Ext.Window({
el:'hello-win',
....
items:
loginForm,
buttons:[{
text:'OK',
handler:function(){
if(win.getComponent('loginForm').form.isValid()){
win.getComponent('loginForm').form.submit({
url:'/Test/test.do',
success:function(form,action){
Ext.Msg.alert("Login success!",action.result.message);
},
failure:function(form,action){
Ext.Msg.alert('Login fail",action.result.message);
}
});
}
}
}
});
Action class is follows:
public String login() throws Exception{
boolean success;.
....
if(success){
return SUCCESS;
}
else{
setMessage("Your ID or password is wrong");
return null;
}
}
configure file is follows:
<struts>
<package name="Test" namespace="" extends="json-default">
<action name="login" class="Test.Login" method="test">
<result type="json"/>
</action>
</package>
</struts>
If I set <result>main.jsp</result>, when I click OK button,it will
raise javascript error,because extjs don't get json message.
If I set <result type="json"/>,whether I login success or fail,the
login page will don't redirect,If login success,I want to redirect
this page to main.jsp,but it don't redirect.What can I do about
configure file? I don't know how to do it.I have no idea about it.
Any idea will be appreciated!
Thanks in advance
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]