Hey all:

My web application stores a users chosen Locale preferences in the database. When the user logs in the next page (home page) should reflect their preference. What is strange is the home page doesn't show as French for example, until the user navigates away and returns. So, upon initial log in of a user who has chosen French as their preference the home page is in English if you click away and then return it's French.

My code snips are below which show how the SessionLocaleResolver and LocaleChangeInterceptor are configured as well as how the HomeController updates the session with the appropriate Locale.

Code:
 <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" > 
	 	<property name="defaultLocale" value="en" />
	 </bean>
	 	
	<mvc:interceptors>
		 <bean id="localeChangeInterceptor"
			class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
			<property name="paramName" value="langId" />
		</bean>
	</mvc:interceptors>
Here is the code for updating the Locale. I have printed to the console the results of getting the SessionLocaleResolver out of session and it is indeed set to French, but the page just doesn't update or change.


Code:
			
	final LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);

	if (localeResolver != null) {

	   final String newLocaleName = userProfile.getDefaultLocaleId();

	   if (newLocaleName != null) {
		final LocaleEditor localeEditor = new LocaleEditor();
		localeEditor.setAsText(newLocaleName);

	
		localeResolver.setLocale(request, response,
	      (Locale) localeEditor.getValue());
	   }
	}

Any help and/or guidance is greatly appreciated!