Thursday, April 23, 2009

use multiple application properites file?

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) - Application.Properties

1. one for Welsh(For Example) - Application_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.xml

<servlet>

<init-param>

<param-name>applicationparam-name>

<param-value>/WEB-INF/classes/com/ips/ApplicationResources.properties>

>

<init-param>

<param-name>application1param-name>

<param-value>/WEB-INF/classes/com/ips/ApplicationResources_cy.properties>

>

servlet>

struts-config.xml

<message-resources parameter="com.ips.ApplicationResources" null="false"/>

<message-resources parameter="com.ips.ApplicationResources_cy" key="welsh" null="false" />

lost-cy.jsp

<html:errors bundle="welsh"/>

<html:form action="/lost-cy" method="post" onsubmit="return lostvalidate()">

<td class="border" align="left">

<html:text property="email" styleId="email" size="35">html:text>

<label class="error" id="emailerror"> <bean:message bundle="welsh" key="errors.email.required" />

label>

td>


No comments: