struts 1验证

时间:2012-02-11 16:22:49

标签: struts-1 struts-validation

大家都在使用struts验证时遇到问题,如下所示: 加载编辑配置文件页面,当用户单击保存时,如果存在错误则应执行验证,必须发生重定向到同一页面,并显示验证错误,并加载数据,否则执行调用方法。如果错误列表有值但屏幕上没有出现错误会发生什么,我的代码是: 我正在使用struts 1

<action path="/selectUserAction" validate="true" input="/selectUserAction.do"       type="com.bg.sharjah.usermanagement.manageusersgroups.web.actions.SelectUserAction" 
        name="editUserProfileFormBean" scope="request">


    @Override
public ActionErrors validate(ActionMapping mapping,
        HttpServletRequest request) {
    //Logger.getAnonymousLogger().log(Level.WARNING,"");
    ActionErrors errors = new ActionErrors();
    try{

    errors = super.validate(mapping, request);
    System.out.println("validate <<<<<<<<<<< "+errors.size());

    }catch(Exception e)
    {
        e.printStackTrace();
    }
    return errors;
//  Validation.match(errors, password, confirmPassword);
    //Validation.match(errors, email, confirmEmail);    

}

注意: 我的表单bean用于不同的操作,我还需要知道如何使用输入属性重定向到同一页面?

1 个答案:

答案 0 :(得分:0)

Thanx所有我发现问题是资源包问题。