You could implement your own MessageResources which could call a java class instead of a properties file.
You would need to do something like the following: 1) Create your own MessageResources implementation: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/util/MessageResources.java?view=markup public class VarMessageResources extends MessageResources { public String getMessage(Locale locale, String key) { // call your java class here } } 2) Create a MessageResourcesFactory public class VarMessageResourcesFactory extends MessageResourcesFactory { public MessageResources createResources(String config) { return new VarMessageResources(this, config, this.returnNull); } } 3) Configure Struts for your custom MessageResources (using a "bundle" key) <message-resources key="validatorVarResources" factory="mypackage.VarMessageResourcesFactory" /> 4) Reference your custom message resources in the validation.xml <var resource="true" bundle="validatorVarResources"> <var-name>datePattern</var-name> <var-value>dateOfBirth.pattern</var-value> </var> Niall On 8/7/06, Jean-Marie Pitre <[EMAIL PROTECTED]> wrote:
Thank you Niall, Do you know if I can call a java class instead of a properties file ? Jean-Marie. -----Message d'origine----- De: Niall Pemberton [mailto:[EMAIL PROTECTED] Envoyé: lundi 7 août 2006 15:37 À: Struts Users Mailing List Objet: Re: Validator dynamic var You can do this in Struts 1.3.x and Commons Validator 1.3.0 where the <var> element can come from a resource bundle. See the "1.2 Variables in Resource Bundles" section here: http://wiki.apache.org/jakarta-commons/ValidatorVersion120 Niall On 8/7/06, Jean-Marie Pitre <[EMAIL PROTECTED]> wrote: > > Hi, > > Is it possible to set dynamic variable value in validation.xml file ? > > My application is in several language and I would like avoid to define > several formset definition according to each language to just change > datepatternstrict value. > > Any idea ? > > Thanks, > Regards Jean-Marie. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ------------------- Email Disclaimer http://www.cofidis.be/emaildisclaimer.php --------------------------------------------------------------------- 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]