1,Spring config:
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="0" />
<property name="interceptors" ref="localeChangeInterceptor" />
</bean>
2,All scope change header:
<%
java.util.Locale _currentLocale = org.springframework.web.servlet.support.RequestContextUtils.getLocale(request);
String _localeAsString = _currentLocale.toString();
%>
<c:set var="localeAsString" value="<%=_localeAsString%>"/>
<c:set var="localeSwitchingUrlSc" value="?locale=zh_CN"/>
<c:set var="localeSwitchingUrlTc" value="?locale=zh_HK"/>
<c:set var="localeSwitchingUrlEn" value="?locale=en_US"/>
<c:choose>
<c:when test="${localeAsString eq 'zh_CN'}">
<a href="${localeSwitchingUrlEn}">
go to english
</a>
</c:when>
<c:otherwise>
<a href="${localeSwitchingUrlSc}">
goto chinese
</a>
</c:otherwise>
</c:choose>
3,Display content:
<spring:message code="i18n.testing.key.one" text="default value">
</spring:message>