Hi, 

I'm getting exactly this problem posted last year. 
I've seen many posts on validator resource bundles including this patch:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10868

But have not found THE universally adopted solution.

Just to restate the problem: 

I have a resource bundle for each area of my site:
(struts-config.xml)

<message-resources parameter="resources.application"/>
    <message-resources key="CampaignManagerResources"
parameter="resources.CampaignManagerResources"/>
    <message-resources key="EmailManagerResources"
parameter="resources.EmailManagerResources"/>

Each resources bundle has a copy of the basic default error messages
like:
errors.required={0} is required.


I have validations like this:


                <field
                property="subject"
                depends="required">
                <arg0 key="viewEmail.subject" />
             </field>


And display the error messages like this in a JSP.

<html:errors bundle="EmailManagerResources" />

With this config, when the validation fails, the message
(errors.required) is pulled from the correct bundle but the argument
(viewEmail.subject) is pulled from the default bundle and not the bundle
specified in the <html:errors> tag.


Hs anyone used the above patch? It doesn't seem to include an update of
the validation dtd file.


I really don't want to put all my error messages and arguments into one
file...

Any help at all will be gratefully received. From the amount of similar
posts on this list I feel that this is an issue for lots of people....


--------------------------------------------------

From: Andreas Lundgren <[EMAIL PROTECTED]>
Subject: SV: Insert arguments into Validator error messages?
Date: Tue, 19 Aug 2003 08:06:03 +0100
Content-Type: text/plain;
        charset="iso-8859-1"

When I removed the key = "resource" attribute in the message-resource
declaration in the struts-config.xml, hence using the default
Globals.MessageKey it worked... Can anyone please confirm this? All the
error messages and their arguments needs be to set in a resource-bundle
stored in the default Globals.MessageKey? Hence you can't use
<html:errors
bundle="resource"/> when presenting error messages WITH arguments?

Can anyone confirm that this is the case?

Thank you!

/Andreas


-----Ursprungligt meddelande-----
Från: Andreas Lundgren [mailto:[EMAIL PROTECTED]
Skickat: den 19 augusti 2003 06:22
Till: [EMAIL PROTECTED]
Ämne: Insert arguments into Validator error messages?


Hi,

I trying to insert an argument into a error message using the Validator
framework and I just can't make it work.

The validation itself works and it shows a nice display of my (TEST)
error
message also, but the argument is somehow lost.
If I use the resource="false" attribute it works...

What I am missing here?

validation.xml:

<form name="login">
        <field property="name" depends="required">
                <arg0 key="label.name" />
        </field>
</form>


My bundle namned "resource":

errors.required={0} TEST is required.
label.name=Name

And the output is (using <html:errors bundle="resource"/> )

    TEST is required.

And if I use the resource="false" attribute:

label.name TEST is required.

Why is the error message key found but not the argument key (label.name)
in
my resource-bundle?

Thankful for your assistance!

/Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to