关于Struts2 验证 validateCommit()执行完成,没有继续走下面的方法,而是返回input对应的页面!
java:publicvoidvalidateCommit(){if(!newCommonUtil().validateRandom(getConfirmCode()))...
java:
public void validateCommit() {
if(!new CommonUtil().validateRandom(getConfirmCode())) {
addFieldError("confirmCode", getText("ecare.confirmCode.invalid"));
return ;
}
BusinesService businesService = (BusinesService) SJBUtil.getBean("businesService");
BusinesLoginPo bPo = businesService.businesLogin(businesLoginPo); // 登陆根据工号查询出密码判断
if(bPo != null ){
if(!bPo.getBusinesPwd().equals(this.businesLoginPo.getBusinesPwd())){
addFieldError("businesLoginPo.businesPwd", getText("密码错误,请重新输入!"));
return ;
}
}else{
addFieldError("businesLoginPo.businesName", getText("用户名错误,请重新输入!"));
return ;
}
}
解决了,是这项目里面有拦截器之类的东西,在验证之后进行了拦截,所以执行不下去,之前我也想到这个问题,可对着项目不熟悉,谢谢两位参与。 展开
public void validateCommit() {
if(!new CommonUtil().validateRandom(getConfirmCode())) {
addFieldError("confirmCode", getText("ecare.confirmCode.invalid"));
return ;
}
BusinesService businesService = (BusinesService) SJBUtil.getBean("businesService");
BusinesLoginPo bPo = businesService.businesLogin(businesLoginPo); // 登陆根据工号查询出密码判断
if(bPo != null ){
if(!bPo.getBusinesPwd().equals(this.businesLoginPo.getBusinesPwd())){
addFieldError("businesLoginPo.businesPwd", getText("密码错误,请重新输入!"));
return ;
}
}else{
addFieldError("businesLoginPo.businesName", getText("用户名错误,请重新输入!"));
return ;
}
}
解决了,是这项目里面有拦截器之类的东西,在验证之后进行了拦截,所以执行不下去,之前我也想到这个问题,可对着项目不熟悉,谢谢两位参与。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询