I think your best bet, if you want it globally for, say the
NumberTranslator, your best bet would be to extend that class and call
setMessage("something") in the constructor. At the end of the day, Tapestry
gets the messages using a ResourceBundle:ResourceBundle.getBundle(RESOURCE_BUNDLE, locale).getString(key) So you could make your own ValidatorStrings.properties and put it further up on the classpath than the Tapestry jar. I'm sure there are other ways to do this, but I can't think of any easy and clean ones. -Chris On 10/19/05, Vjeran Marcinko <[EMAIL PROTECTED]> wrote: > > But, that's still case of specifying messages for individual > validator/translator. I want to set it globally for let's say number > translator, when it cannot translate input to numeric value. I don't want > to > set things below for every NumberTranslator in my web app. > > -Vjeran > > ----- Original Message ----- > From: "sean gao" <[EMAIL PROTECTED]> > To: "Tapestry users" <[email protected]> > Sent: Tuesday, October 18, 2005 6:33 PM > Subject: Re: Specifying validating messages ? > > > > Try this > > <bean name="telephoneNumberValidator" > > class="org.apache.tapestry.valid.PatternValidator"> > > <set-property name="patternString">"^[0-9 -]{6,}$"</set-property> > > <set-message-property name="patternNotMatchedMessage" > > key="telephone-number-pattern-not-matched"/> > > <!--set-property name="patternNotMatchedMessage" > > expression="getMessage('telephone-number-pattern-not-matched')"/--> > > </bean> > > Sean > > > > > > Vjeran Marcinko wrote: > >> Well, people were mentioning some ValidationStrings.properties inside > >> Tapestry jar, but I haven't found exactly what's the way to override > >> these default messages. > >> > >> -Vjeran > >> > >> ----- Original Message ----- From: "Chris Norris" > >> <[EMAIL PROTECTED]> > >> To: "Tapestry users" <[email protected]> > >> Sent: Tuesday, October 18, 2005 4:32 PM > >> Subject: Re: Specifying validating messages ? > >> > >> > >> Was there a way to do it globally in the old version? With the new > ones, > >> and > >> I forgot this when I wrote the above email, you can specify things when > >> using the translator: tag like so: > >> > >> translator="translator:number,omitZero=false" > >> > >> You could probably do something like > >> "translator:number,message=something" > >> althought I'm not entirely sure on how to get a whole string in there. > >> But > >> that's not global, either. Your best bet may be to make a custom > >> translator. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
