[ http://issues.apache.org/struts/browse/STR-2827?page=all ]
Don Brown updated STR-2827:
---------------------------
Bugzilla Id: (was: 39251)
Component: Core
(was: Apps)
Assign To: (was: Struts Developer Mailing List)
> validator's locale
> ------------------
>
> Key: STR-2827
> URL: http://issues.apache.org/struts/browse/STR-2827
> Project: Struts Action 1
> Type: Bug
> Components: Core
> Versions: 1.2.9
> Environment: Operating System: All
> Platform: All
> Reporter: Weili Shao
>
> I am trying to write a form with zip/postal code, which needs to be
> validated.
> The validation is based on country. So if it's a US zip code, the form should
> be "ddddd-dddd" or "ddddd". If it's a Canada postal code, the form should be
> "a1b 2c3". And if it's another country's postal code, we will allow any kind
> of
> input.
> So according to struts manual, the formset with no locale specifications is
> set
> to be the default locale. So I created 3 validation xml files:
> /WEB-INF/validation_en_US.xml, /WEB-INF/validation_en_CA.xml,
> /WEB-INF/validation.xml.
> Here is what I found: when I set en_CA as my country, Canadian's postal zip
> will
> be correctly validated. When I set any other country as my country, the
> validation rule will be either from validation_en_US.xml or validation.xml,
> depending on which validation xml file is being put in the struts-config.xml
> first. So I debugged code of ValidatorPlugIn's code and figured that the 2
> formsets (default and en_US) are both considered as value of the key "en_US"
> in
> the formset FashHashMap.
> And another thing I found for the validation xml files is that as much as
> country information is the only thing I will need for the zip code
> validation.
> I just have to enter the language attribute in the formset tag. So instead of
> using <formset country="CA">, I will have to specify the language for this for
> the formset. This is kind of awkward. Because it's not necessary a user
> viewing our website is set his/her lauguage to be the same as the formset
> setting, although he/she could be in US/Canada. It looks like struts has a
> much
> better message search rule than validation search rule.
> I am pretty sure I can fix all this by overriding the ValidatorPlugin class.
> I
> just want to try my luck to see if the developers of the struts considering
> this
> as a bug or I actually mis-configged anything.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]