commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Schipperheyn" <>
Subject Validator internationalization: constants not applied
Date Sat, 23 Apr 2005 20:27:33 GMT

I have a struts application that needs to serve multilingual websites for
multiple countries. Every country has the same language parameters but
varying validation-constants for things like zipcodes and mobile phones. I
use commons validator 1.1.4 and struts 1.2.6

When the validation is applied, the locale specific validation (_NL) isn't
applied but the default. When I step through the code I see in
ValidatorResources getForm that the hFormSets has two keys: "nl_NL" and
"_NL". Under nl_NL the default formset is stored and under _NL the _NL
formset. I don't understand this. There is no "nl_NL" key defined in my
validation files. 

Is this a bug or a configuration issue? How do I get around it?

    <!-- ========== Controller Configuration ============ -->
    	<set-property property="processorClass"
value="" />
    <!-- ========== Message Resources Definitions =========== -->
    <message-resources parameter="" null="false"

    <!-- ========== Plug Ins Configuration =================================
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames"
ion-constants_NL.xml" />

In my secure request processor I (for testing purposes) set my Locale
	protected void processLocale(HttpServletRequest req,
HttpServletResponse res) {
		req.getSession().setAttribute(Globals.LOCALE_KEY, new

		<constant-value>^06[-| ]?[0-9]{8}$</constant-value>
		<constant-value>^[0-9]{4} [a-zA-Z]{2}$</constant-value>

<formset country="NL">
	<form name="EditSubscriberForm">
		<field property="zipcode"
            <msg name="mask" key="baseprofileform.errors.zipcodeformat"/>
            <arg0 name="required" key="baseprofileform.zipcode"/>
            <arg0 name="mask" key="baseprofileform.zipcode"/>

		<form name="EditSubscriberForm">
			<field property="zipcode"
                <arg0 name="required" key="baseprofileform.zipcode"/>
	        <field property="provinceID"
                <arg0 key="subscriptionform.province"/>
	    			<var-value>(*this* != 0)</var-value>

Kind regards,
Marc Schipperheyn

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message