PDA

View Full Version : Spring Struts integration


rajkum.234
Mar 23rd, 2006, 01:45 AM
Hi

i am working on a project where i integrate struts with spring. using struts tags i am displaying i18n messages for which i kept my resources properties file int /WEB-INF/classes folder. When I wanted to access some of the keys from the property file into a combo box in Struts form, i am creating a bean as shown below
------------------------------------------------------
<bean id="messageResource" class="org.springframework.beans.factory.config.PropertyP laceholderConfigurer">
<property name="location"><ref bean="filebean"/></property>
</bean>
<bean id="filebean" class="org.springframework.core.io.ClassPathResource">
<constructor-arg index="0"><value>MyAppResources.properties</value></constructor-arg>
</bean>
------------------------------------------------------

the above is working fine for the default locale.

now, i wanted to use the above with I18N. how can i get the reference to the resource properties file being used by Struts throug Spring.

plz help me

rajkum.234
Mar 23rd, 2006, 11:54 PM
Hi viewers,
the above problem is solved through using ResourceBundleMessageSource

<bean id="messageSource" class="org.springframework.context.support.ResourceBundle MessageSource">
<property name="basename"><value>MyAppResources</value></property>
</bean>

Thank you all