On 8/16/06, Scott Van Wart <[EMAIL PROTECTED]> wrote:
I tried the following:<field property="name" depends="maxlength"> <msg name="maxlength" key="error.name.overflow" /> <arg name="maxlength" bundle="constraints" key="name.length" /> </field> Now I figured that this would cause the maxlength validator to get the value for maxlength from message resources, rather than hardcoding it with var, var-name and var-value tags. But it doesn't! It only uses this to pass to the {0} in the error message (in org.apache.struts.validator.FieldChecks.validateMaxLength, version 1.1.4): // No reference to resources at this point, only in the exception handler int max = Integer.parseInt(field.getVarValue("maxlength")); Am I missing something?
Yes - two things: 1) The maxlength validator never gets the "variable" values used to validate from <arg> elements - they are only ever used for "error message arguments". So you need to specify a <var> element to specify the maxlength value. 2) Support for "variables" being specified in "resources" was added to Struts 1.3.x (and not the 1.2.x branch) - so even if you upgraded to Validator 1.2.0 or Validator 1.3.0 its not going to work with Strutsb 1.2.x - try Struts 1.3.5 http://wiki.apache.org/jakarta-commons/ValidatorVersion120 Niall
- Scott
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

