You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2004/04/28 15:36:01 UTC

multiple message resources

Hello.
I have a project which is really a combination of 3 other projects.  So 
in each of the
initial project's I have an ApplicationResources.properties file.  I 
have renamed each
of these files to be specific to the project.  projectAMessages.properties,
projectBMessages.properties, projectCMessages.properties.  Now, in 
"Project D" I want
to be able to see all of those messages.  So I have setup my 
struts-config.xml to look
like so:

    <message-resources parameter="projectAMessages" null="false"/>
    <message-resources parameter="projectBMessages" null="false"/>
    <message-resources parameter="projectCMessages" null="false"/>
    <message-resources parameter="strutsMessages" null="false"/>

The last one, "strutsMessages" is the file with all of the "error." 
messages that come
standard with Struts.  When I look at the log file, only the last one 
gets loaded.  I
was thinking that setting it up this way, they would all get loaded 
under the default
key.  Apparently, only one can be loaded under a key.  So I tried adding 
key="projectA"
etc. to each one.  In the logs I can see they each get loaded - great!  
But I still can't
seem to produce the error messages I want.  I get messages like so:

???en_US.category.categoryDesc??? is required.

Where did "en_US" come from?  Is struts trying to load each of the 
message-resources
as a different locale?  It seems to be that the only reason anyone wants 
different
message-resources is for the same message to be listed in different 
languages.  Is what
I am asking for possible?  I would imagine that it is and that I am 
simply doing something
wrong.

Any help is much appreciated.  Thanks.


Charlie


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


Re: multiple message resources

Posted by Henrique VIECILI <vi...@softplan.com.br>.
Hi,

remember that you must specify the bundle for each <bean:message>.

ex.:
<bean:message bundle="projectA" key="category.catDesc" />

otherwhise struts will try to find 'category.catDesc' key in the default
("org.apache.struts.action.MESSAGE") message-resource bundle.

Henrique Viecili


----- Original Message ----- 
From: "Charles N. Harvey III" <ch...@alloy.com>
To: <us...@struts.apache.org>
Sent: Wednesday, April 28, 2004 10:36 AM
Subject: multiple message resources


> Hello.
> I have a project which is really a combination of 3 other projects.  So
> in each of the
> initial project's I have an ApplicationResources.properties file.  I
> have renamed each
> of these files to be specific to the project.  projectAMessages.properties,
> projectBMessages.properties, projectCMessages.properties.  Now, in
> "Project D" I want
> to be able to see all of those messages.  So I have setup my
> struts-config.xml to look
> like so:
>
>     <message-resources parameter="projectAMessages" null="false"/>
>     <message-resources parameter="projectBMessages" null="false"/>
>     <message-resources parameter="projectCMessages" null="false"/>
>     <message-resources parameter="strutsMessages" null="false"/>
>
> The last one, "strutsMessages" is the file with all of the "error."
> messages that come
> standard with Struts.  When I look at the log file, only the last one
> gets loaded.  I
> was thinking that setting it up this way, they would all get loaded
> under the default
> key.  Apparently, only one can be loaded under a key.  So I tried adding
> key="projectA"
> etc. to each one.  In the logs I can see they each get loaded - great!
> But I still can't
> seem to produce the error messages I want.  I get messages like so:
>
> ???en_US.category.categoryDesc??? is required.
>
> Where did "en_US" come from?  Is struts trying to load each of the
> message-resources
> as a different locale?  It seems to be that the only reason anyone wants
> different
> message-resources is for the same message to be listed in different
> languages.  Is what
> I am asking for possible?  I would imagine that it is and that I am
> simply doing something
> wrong.
>
> Any help is much appreciated.  Thanks.
>
>
> Charlie
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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