plutobing
plutobing
2008-12-12 23:20

使用Struts2处理ext.form提交后的返回问题,请指教

  • ext
  • javascript

我使用的是Struts2+Ext2.2,向实现Ext.form提交后台保存的功能,使用的是jsonplugin,
var form = formPanel.getForm();
form.submit({
url:'userAction.action',
param:{actionMethod:'save'},
method:post,
waitMsg:'数据载入中……',
successProperty:'success'
success:function(form,action){
Ext.MessageBox.alert("Message", "Success");
},
failture:function(form,action){
Ext.MessageBox.alert("Error", "Failture");
}
});
后台:
Boolean success = false;
public String execute() throws Exceptions{
if (getActionMethod().equals('save')) {
success = userService.save();//userService.save()成功返回True,失败返回False
}
return SUCCESS;
}

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

我指定了成功属性,当Success=TRUE是能先是Message:SUCCESS,但当success=FALSE时,确不执行failture方法,这是为什么,能不能使其在success=FALSE时,执行failture

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答