• Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts: another resources bundle with validation.xml  RSS feed

 
Adri Smith
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • 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
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!