struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Pinter" <anthony.pin...@pfizer.com>
Subject Re: DispatchAction descendant and Struts Validator problems
Date Fri, 25 Jul 2003 14:13:15 GMT
Just FYI, I found a post in the newsgroup archives that solved my problems.
The author's name eludes me, but he's certainly sharp.

All one must do is set validate to false for the action mapping in the
struts-config.xml and then, in the methods in which one wishes to validate,
call something like:

  protected boolean isFormValid(HttpServletRequest request,
                                ActionMapping mapping,
                                ActionErrors errors,
                                ActionForm form) {
    DynaValidatorForm dvForm = (DynaValidatorForm) form;

    errors.add(dvForm.validate(mapping, request));
    if (!errors.isEmpty()) {
      saveErrors(request, errors);
      return false;
    } else return true;
  }
}

Simple fix from a very helpful newsgroup,
Tony




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message