I hesitate to answer this as I don't use modules. However, my understanding
goes like this:

All message resources are stored in "application" context. The default
module is stored under either the key specified in <message-resources> or
the default, which is Globals.MESSAGES_KEY.  Message Resources for modules
are the same except they append the module prefix to store the message
resources in application scope.

So, in your two modules, if one is a "default" module (i.e.
<param-value>config</param-value> in web.xml), you can just specify the
message resources there.

If neither of your modules is a "default" module (i.e. both
<param-value>config/mymodule1</param-value> in web.xml), then why don't you
add a "default" module struts-config.xml, which just has the message
resources in.

In Struts 1.1 things like the <bean:messages> tag either look for messages
resources (using RequestUtils) under the default key (Globals.MESSAGES_KEY)
or you have to specify it as a "bundle" attribute - so if you wanted a
"module" specific message resources, you need to specify the whole key in
the "bundle" attribute - even if in your struts-config.xml, you let it get
set to the default (i.e.Globals.MESSAGES_KEY + module prefix) .

In Struts 1.2 they have improved <bean:messages> so that it looks for
messages resources (using TagUtils) first under a key specified by "bundle"
plus the module prefix appended (default for bundle being
Globals.MESSAGES_KEY) and then, if not found under a key specified just by
the "bundle" attribute. This means that if you have "module" specific
message resources, you now DONT have to specify the whole key in the
"bundle" attribute if in your struts-config.xml, you let it get set to the
default (i.e.Globals.MESSAGES_KEY + module prefix).

Anyway to summarise, in your scenario, I don't think the differences between
1.1 and 1.2 affect what you want to do. You just need to specify your
message resources in the "default" module.

Niall


----- Original Message ----- 
From: "Ashutosh Satyam" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, March 12, 2004 4:12 AM
Subject: RE: On usage of Resource Bundle


Still waiting if somebody can reply to the below question which I had posted
yesterday.

Regards,
Ashutosh

-----Original Message-----
From: Ashutosh Satyam
Sent: Thursday, March 11, 2004 11:22 AM
To: Struts Users Mailing List
Subject: On usage of Resource Bundle

Hi,
 I needed one small clarification regarding the usage of resource bundle.
My web application is divided into two sub modules i.e. basically the
application uses two struts configuration file.
     I'm going to have only one resource bundle. Now, is it necessary to
have <message-resources>
tag configured in both the struts configuration file? Will providing the
configuration at one
place won't suffice? Since, MessageResources objects are created by the
controller i.e. ActionServlet and saved
in the ServletContext using either a generic key Globals.MESSAGES_KEY or the
key provided as part
of the 'key' attribute.
   So, I feel it should be accessible to the Action classes, which are part
of
the other struts configuration file too.

Is my understanding correct? Anyone who can provide me a better insight on
the same
will be useful.


Regards,
Ashutosh



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

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




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

Reply via email to