On 9/13/06, Jacek Konopelski <[EMAIL PROTECTED]> wrote:
Hi All - it's my first mail here but don't be scared ;)Recently I have been doing My best to divide My web application into modules - so My boss could sell main part without addons (modules). I successed in everything except validation... What I have: 0. I'm using: Struts 1.2.2 1.Two struts-config.xml files - main One and the other for My module with such entry: <message-resources parameter="resources.application" /> <!-- main resource --> <message-resources key="orderResources" parameter="resources.application-order"/> <!-- module resource -> 2.Two resource bundles, main: "application.properties" with whole standard validation errors keys, and "application-order.properties" for My "order" module 3.Validation.xml with entry: (date pattern defined) ... * ** * <form name="orderDetails"> <field property="orderdateForm" depends="date"> <arg0 key="order.detail.orderdate" /> <var> <var-name>datePattern</var-name> <var-value>${date_format}</var-value> </var> </field>* *4.and validation-rules.xml (as default) The Problem: When validation of input data fails (in example: wrong date pattern) , I get this error: "Incorrect date format in Field" but as You can see fields' name is missing....(because it's in the other resource bundle) Everything works fine when "fields' name" and entry "errors.date=Incorrect date format in Field {0}." are in one common (main) resource bundle but it's not what I want. Unfortunately what I want is to have errors keys in main resource and fields' names in appropriate module resource... For <html:link> or <bean:messages> I can set bundle="orderResources" and it works brilliant but I can't do that for <arg0> Does Anyone know how to "explain" to struts that it should look for this field's name in this particular resource?
Bundle support was only added to validator from version 1.1.4 onwards (current Validator version is 1.3.0) - but as well as upgrading your version of Commons Validator, you also need to upgrade from Struts 1.2.2 to at least Struts 1.2.7 (latest 1.2.x version is 1.2.9). As well as that, you need to move from using the arg0-arg3 elements to the newer <arg position="0"> format. Struts 1.2.9 and Struts 1.3.5 have an example page of using bundles with Commons Validator in the "struts-examples" webapp shipped with the binary distro. http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section7_2 http://wiki.apache.org/struts/StrutsUpgrade http://jakarta.apache.org/commons/validator/changes-report.html http://wiki.apache.org/jakarta-commons/ValidatorVersion120 Niall
Thanks and Regards Jack - Jacek Konopelski
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

