File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Resource Bundles Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Resource Bundles" Watch "Resource Bundles" New topic

Resource Bundles

sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
Once the are defined we have to make struts aware of them through
1. ActionServlets <init-parameter> tag as follows

2. we can make struts aware of these through struts-config.xml file
<message-resources parameter="ApplicationResources" />

The question is can an application can contain web.xml application resources as well as struts-config message-resources.
what is the differnce between them
Sachin Kediyal

Joined: May 11, 2006
Posts: 9
Hi Prasanna,
There is a slight difference. Struts provide internationalization features to a web application means the custom labels in the application can be viewed in different language characters as required by the end user for example a client wan'ts his companies web application to be accessed by English as well as Japanese users. In this case you have to define two different Resource bundle files (.properties) containing english and Japanese language characters and had to map this with your struts-config.xml and the view. Rest everything is being taken care by the struts framework.
But in case you wan't to implement the same stuff using web.xml then you need to implement your own customized logic.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Defining Struts message resource bundles through <param-name>application</param-name> in web.xml is deprecated. The preferred method to define them in later versions is in the struts-config.xml file. If you want to define more than one bundle, you can do so as long as you define a key for each resource like this:

<message-resources key="myResources" parameter="com.mycompany.ApplicationResources"/>
<message-resources key="moreResources" parameter="com.mycompany.MoreApplicationResources"/>

Then, in your <bean:message> tag you specify bundle="myResources" or bundle="moreResources"

Consultant, Sima Solutions
sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
Thanks alot Merrill
I agree. Here's the link:
subject: Resource Bundles
It's not a secret anymore!