Link to home
Start Free TrialLog in
Avatar of mikehalfsheen
mikehalfsheen

asked on

Using two (or more) resource files in struts

I've a struts app that uses an ApplicicationResources.properties file as a message-resource. I'd like  (  well the powers that be would like :-( )  to split the file in two so that the customer can edit certain elements within the file. How do I get Struts to use two - message-resources ?
Avatar of Kuldeepchaturvedi
Kuldeepchaturvedi
Flag of United States of America image

According to struts you should be able to define more that one resource bundle for your app..

Struts has built in support for internationalization (I18N). You can define one or more <message-resources> elements for your webapp; modules can define their own resource bundles. Different bundles can be used simultaneously in your application, the 'key' attribute is used to specify the desired bundle.

className - Classname of configuration bean. [org.apache.struts.config.MessageResourcesConfig] (optional)
factory - Classname of MessageResourcesFactory. [org.apache.struts.util.PropertyMessageResourcesFactory] (optional)
key - ServletContext attribute key to store this bundle. [org.apache.struts.action.MESSAGE] (optional)
null - Set to false to display missing resource keys in your application like '???keyname???' instead of null. [true] (optional)
parameter - Name of the resource bundle. (required)
Example configuration:


<message-resources
    parameter="MyWebAppResources"
         null="false" />

This would set up a message resource bundle provided in the file MyWebAppResources.properties under the default key. Missing resource keys would be displayed as '???keyname
ASKER CERTIFIED SOLUTION
Avatar of Kuldeepchaturvedi
Kuldeepchaturvedi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial