| Author |
How to do share message-resources?
|
yun liu
Greenhorn
Joined: Apr 11, 2005
Posts: 6
|
|
We assumed that if we used messages or errors (bean:message and html:errors) within a model and the message was not found in the message resources for that model, that Struts would look to the default app for the messages. We did not like the idea of duplicating messages across all model. For example, most all of our modules will be using messages for our buttons like Save, New, Cancel, Delete, etc. (we are using i18n so it's not feasible to hard-code these). We wanted to define these once in the message resources for the default app and override the message in the model as necessary. How to do this,Please give me some advise. I used Struts1.2. Thanks advance david.liu
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
There is no concept of inheritance with modules. Each module is it's own separate entity, and the configuration at the root module is not propagated to the other modules. You can, however, specify more than one resource bundle per module. So you could create a resource bundle that contains messages common to all modules and include that bundle in each module along with the bundle unique to that module. The down side of this method, though, is that once you have more than one resource bundle, you must specify which one you're using with every <bean:message> tag. Here's an example of the struts-config.xml file: <message-resources key="base" parameter="com.mycompany.ApplicationResources"/> <message-resources key="module" parameter="com.mycompany.module.ApplicationResources"/> Then, when you use the <bean:message> tag, you must specify bundle="base" or bundle="module"
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: How to do share message-resources?
|
|
|