Spring MVC 3 Изменение локали с использованием неработающей ссылки

Edit: My Spring framework version 3.0. 5

Небольшая проблема: язык не меняется, когда я нажимаю ссылку средства смены языка.

Языковые файлы (messages_xx.properties) находятся в каталоге пути к классам i18n. Это следующие файлы:

i18n/messages_en.properties
i18n/messages_ar.properties

Spring Configuration

<!-- Component scanner. This is used to automatically find Spring annotations like @Service and @Repository -->
    <context:component-scan base-package="com.keype" />

    <!-- Annotation driven programming model -->
    <mvc:annotation-driven />   
    <context:annotation-config />
    <mvc:resources mapping="/static/**" location="/static/" />


    <!-- Session Object Configuration -->
    <bean id="session" class="com.keype.system.Session" scope="session">
        <aop:scoped-proxy />
    </bean>

    <!-- The View Resolver -->
    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp"
          />

    <!-- i18n Configuration. Default language is english. Change language using ?language=en -->
    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        <property name="paramName" value="lang" />
    </bean>

    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
        <property name="defaultLocale" value="en" />
    </bean>

    <!-- Message text files. This is set UTF-8 to display Arabic UTF correctly. -->    
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="classpath:i18n/messages" />
        <property name="defaultEncoding" value="UTF-8"/>
    </bean>

Раздел из кода JSP

<a href="?lang=ar"><spring:message code="header.arabic" /></a> | 
    <a href="?lang=en"><spring:message code="header.english" /></a> 

Проблема в том, что когда я щелкаю ссылку выше для изменения языка, функция изменения локали не работает. Я проверил, изменив defaultLocate на ar и получаю арабский текст.

Что здесь может быть не так? В журнале tomcat тоже ничего нет.

12
задан tereško 11 February 2014 в 20:04
поделиться