localization - Spring Framework - How to change locale in controller -


i new spring, , confusing localization. i'm using following code text messages_jp.properties file.

<bean id="messagesource" class="org.springframework.context.support.resourcebundlemessagesource">     <property name="basename" value="messages" /> </bean> 

and want switch text messages_en.properties file, there ways change locale in controller within if...else... block, not using url params "?lang=en", like:

if (user.getlang() == 1) {     // set locale en } else {     // set locale jp } 

thanks in advance!

try one

<util:properties id="yourfilenameid" location="classpath:/yourfilename.properties"/> 

in controller

@value("#{yourfilenameid['message_id']?:1}") private int smalltext; 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -