Wolfgang,

You're obviously using "locale specific" formsets in your appilication. I
just thought I would highlight one of the changes in Struts 1.3.0 /
Validator 1.2.0 that might be of interest to you.

You can now specify a resource key/bundle for Validator <var> values - for
example if you want different locales to validate a date using locale
specific formats, then you can put the format to use in a resource bundle
and specify the key in your validation.xml:

   <field property="orderdate" depends="date">
      <var resource="true" bundle="validation">
         <var-name>datePattern</var-name>
         <var-value>orderdate.pattern</var-value>
      </var>
   <field>


I believe that in alot of circumstance this will completely remove the need
to have locale specific formsets - simplifying peoples' validation.xml by
reducing the duplication of rules for different locales.

     http://svn.apache.org/viewcvs.cgi?rev=289694&view=rev


The struts-examples webapp has been updated in Struts 1.3.0 to include an
example of this - see the "I18N Variables" section on the "Validator
Examples" page.

Niall

----- Original Message ----- 
From: "Wolfgang Gehner" <[EMAIL PROTECTED]>
Sent: Monday, October 03, 2005 8:32 AM


> While bringing an app to a recent build (0909) of struts 1.3 and
> commons-validator-1.2.0, I notice the following related to
ValidatorPlugIn:
>
> When using multiple validation files, as in:
>
> <plug-in clasname="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames"
>
>
value="/WEB-INF/lib/validator-rules.xml,/WEB-INF/moduleA/validationA.xml,/WE
B-INF/moduleB/validationB.xml"/>
> </plug-in>
>
> I get in the tomcat console:
>
> "WARN Overriding FormSet definition. Duplicate for locale: fr"
>
> Result is that validation rules on moduleA are not working.
>
> I suspect  the message is because both validationA.xml and
> validationB.xml have a <formset language="fr">
>
> We used to be able to have one validationX.xml per module without
> problems. (Having the bundle attribute since struts 1.2x made that even
> better, so there could be one resource-file per module).
>
>  I see that now commons-validator 1.2 seems to change this. I fear that
> without a fix I would have to go back to validations for 400 screens in
> one single validationABCDEF...xml.
>
> It looks like commons-validation 1.2 implementation builds a formset key
> based on language, country and variant, but doesn't seem to merge
> formsets any more.
>
> If my analysis is correct, my suggestion would be
> - to either have commons-validator continue to merge formsets for
> backward compatibility, and/or,
> - add a namespace or id parameter as in <formset id="moduleA"
> language="fr">, if necessary to keep the "physical map" feature.
>
> Using existing variant as namespace as in language="fr" country="ch"
> variant="moduleA" would be an ugly hack, because I would have to specify
> the locale as this for every jsp so that validation would still work.
>
> Kind regards,
>
> Wolfgang Gehner



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to