Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resource Bundles

 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
Once the ApplicationResources_language_country.properties are defined we have to make struts aware of them through
1. ActionServlets <init-parameter> tag as follows
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

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
regards
saiprasanna
 
Sachin Kediyal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot Merrill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic