- 论坛徽章:
- 0
|
Action校验:逻辑行为校验
步骤:1:在action类中写入校验代码,如:
if(registerForm.getUserName().equals(registerForm.getPassWord()))
{
ActionErrors errors = new ActionErrors();
errors.add("keyerror",new ActionError("keyerror"));
this.saveErrors(request, errors);
return mapping.getInputForward();
}
如果发生错误 我们给的跳转就去找了input属性的值
2:在资源文件中进行描述 keyerror=userName or passWord invalidate
3:在页面需要显示的地方进行调用
html:errors property="keyerror"/>
OK 最重要的是struts的校验框架!
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/72940/showart_1162549.html |
|