• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts: another resources bundle with validation.xml

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am actually trying to use (server side) validation rules with another bundle than the default I defined in my web.xml. The 2 bundles are well configured (in struts-config,...), I am using both in my jsp pages without any problems.

I have found a way to specify that the messages corresponding to some validation rules comes from my specific bundle. Here is my code line for applying a validation rule on a property (where UC189Resources is the specific bundle):

<msg name="rquired" key="errors.required" bundle="UC189Resources"/>

but I do not find a way to specify that the arguments are coming also from this specific bundle.

<arg0 key="errors.required.fieldname"/>

I would have been glad to have the possibility to make that:

<arg0 key="errors.required.fieldname" bundle="..."/>

Does anyone have an idea how to make it ?

Thanks in advance,
ADri
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adri,

The use of <arg0> to <arg3> is deprecated as of 1.1 version of the validator. You can however still use them, but resource "bundle" support is not provided.

It is recommended to use <arg position="0"/> instead. The arg element has the "bundle" attribute.

Your xml would now look like this.
<msg name="required" key="errors.required" bundle="UC189Resources" />
<arg position="0" key="errors.required.fieldname" bundle="UC189Resources" />

I got this information from the validator_1_1.dtd file. Most DTDs are very well documented.

Sheldon
 
Adri Smith
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great !

I really thank you for your help, this helps me much.

I wish you all the best

ADri
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your welcome, glad to be of help.

When I read your question, I did not know the answer. Nor did I know that <arg0> to <arg3> was deprecated.

Now I do, so you have helped me too.
All the best to you too.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic