DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=28623>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=28623 validateExcatLength()-method in FieldChecks ? Summary: validateExcatLength()-method in FieldChecks ? Product: Struts Version: Nightly Build Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Validator Framework AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hi, i need sometimes for (german)-zip codes minLength and maxLength. so i wrote an excatLength()-Method. would it be usful, to have such a method in FieldChecks? here it is: public static boolean validateExactLength( Object bean, ValidatorAction va, Field field, ActionMessages errors, HttpServletRequest request) { String value = ValidatorUtils.getValueAsString(bean, field.getProperty()); if (value != null) { try { int exact = Integer.parseInt(field.getVarValue("exact")); if (value.length() != exact) { errors.add( field.getKey(), Resources.getActionMessage(request, va, field)); return false; } } catch (Exception e) { errors.add( field.getKey(), Resources.getActionMessage(request, va, field)); return false; } } return true; } in validator-rules.xml i added this: <validator classname="net.wessendorf.j2ee.struts.utils.Validator" method="validateExactLength" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" msg="errors.exact" depends="required" name="exact"/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]