But can't you just define a message specific to the field and validator for
each definition in the validations.xml file?
<field property="avg_meter_age" page="5"
depends="required,integer,intRange">
<arg0 name="required" key="PF_Report_5.AvgMeterAge"/>
<msg name="integer"
key="validation.error.PF_Report_5.AvgMeterAge.number"/>
<msg name="intRange"
key="validation.error.PF_Report_5.AvgMeterAge.number"/>
<arg1 name="intRange" key="${var:min}" resource="false"/>
<arg2 name="intRange" key="${var:max}" resource="false"/>
<var><var-name>min</var-name><var-value>0</var-value></var>
<var><var-name>max</var-name><var-value>50</var-value></var>
</field>
-----Original Message-----
From: Scott Van Wart [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 25, 2006 11:10 PM
To: Struts Users Mailing List
Subject: (Struts validation) Different message resource keys rather than
placeholders
The validator, by default uses stuff like this:
errors.required={0} is required.
I'd like to be able to use entirely different message keys depending on
the field, rather than always using errors.required. The solution for
the "required" validator was to simply use a passthrough key like this:
validation.passthrough={0}
..and then edit validator-rules.xml to use
msg="validation.passthrough". However, the other validator plugins are
a little more complex, like date masks, maxlength, etc. Is there a
better way to approach this?
Thanks,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]