How to use more than one ApplicationResources.properties in struts.
SCENARIO
The scenario is you have two properties files
1. one for english(For Example) - ApplicationResources.properties
1. one for welsh(For Example) - ApplicationResources-cy.properties
The two
jsp one is for english 1. lost.jsp
for welsh 2. lost-cy.jsp
The change to be made in the
1. web.xml 2. struts config.xml 3. lost-cy.jsp
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<
servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>/WEB-INF/classes/com/example/ApplicationResources.properties</param-value>
</init-param>
<init-param>
<param-name>application1</param-name>
<param-value>/WEB-INF/classes/com/example/ApplicationResources-cy.properties</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>lost.jsp</welcome-file>
</welcome-file-list>
</web-app>
<message-resources parameter="com.example.ApplicationResources" null="false"/>
<message-resources parameter="com.example.ApplicationResources-cy" key="welsh" null="false" />
To access ApplicationResources.properites, use <bean:message key="aKey"/>
Then to access ApplicationResources-cy.properties,
just use <bean:message bundle="welsh" key="anotherKey"/>
Both the properties file having the Key is same but the value differs.
Follow the above to work successfully with two properties file for two jsp thats differs in language
This example Matches only for the scenario at the top