You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Holger Moosbauer <hm...@tecon.de> on 2006/03/14 18:56:34 UTC

Change error bundle validatior-rules

Hello "friends",

 

 

 

I have a serious problem here, maybe someone can help me.

 

Thank you first :-) .. OK, the problem ... how can I change the 

 

application resource bundle for xml validation?

 

 

 

I can read in validatior-rules.xml ... 

 

 

 

.....

 

 

 

These are the default error messages associated with

 

   each validator defined in this file.  They should be

 

   added to your projects ApplicationResources.properties

 

   file or you can associate new ones by modifying the

 

   pluggable validators msg attributes in this file.

 

 

 

   # Struts Validator Error Messages

 

   errors.required={0} is required. .... 

 

 

 

... a.s.o.

 

 

 

How does the validator know this file when I don't pass an

 

explicit bundle value?

 

It's annoying here, because I have to overwrite the default key for each
field with something like that ...

 

 

 

<msg name="intRange" bundle="default"

key="validation.error.integer.range.field"/>

 

 

 

How can I avoid this?

 

 

 

Thank you and Greetings


Re: Change error bundle validatior-rules

Posted by Laurie Harper <la...@holoweb.net>.
Holger Moosbauer wrote:
> Hello "friends",
> 
> I have a serious problem here, maybe someone can help me.
> Thank you first :-) .. OK, the problem ... how can I change the 
> application resource bundle for xml validation?
> 
> I can read in validatior-rules.xml ... 
> [...]
> 
> How does the validator know this file when I don't pass an
> explicit bundle value?

It doesn't; if you don't pass an explicit bundle name, the default 
resource bundle will be looked up.

> It's annoying here, because I have to overwrite the default key for each
> field with something like that ...
> 
> <msg name="intRange" bundle="default"
> key="validation.error.integer.range.field"/>
> 
> How can I avoid this?

Copy the message resources from the comment in validatior-rules.xml into 
your default resource bundle (the one you defined with no key in 
struts-config.xml), and edit as required.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org