PDA

View Full Version : Spring MVC: i18n message.properties location


Plastics
Nov 6th, 2007, 10:21 PM
When I use a messageSource like this one and place message.properties inside /WEB-INF/classes it works perfectly.


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


But I am unable to move those property files outside the classes folder. I would like to have them inside /WEB-INF/language/*.

I tried using these values for the basename and a few more but when I try to use those messages from a jsp I can't find those variables

<property name="basename" value="../language/messages"/>
<property name="basename" value="/WEB-INF/language/messages"/>


Anybody knows how can I move them outside classes folder? :confused:

imilina
Nov 7th, 2007, 03:33 AM
Anybody knows how can I move them outside classes folder? :confused:
You can't while using ResourceBundleMessageSource, as it requires messages.properties to be on classpath.

Use ReloadableResourceBundleMessageSource instead.

Regards,
Igor.

Plastics
Nov 7th, 2007, 01:28 PM
Ok, I'll try that tonight and post the results.

Thanks! :cool: