Problem with i18n and Spring 3 mvc namespace
I have not figured out how to get messages resolved when using Spring’s mvc namespace.
For example, a JSP with this line:
<fmt:message key="welcome.title"/>
shows:
???welcome.title???
I have a messages directory under WEB-INF with messages.properties.
Here is the web-servlet.xml (my dispatcher servlet is named web). Any help very much appreciated.
<!-- Scans for @Controllers to deploy as beans -->
<context:component-scan base-package="com.mylittlecompany.web.controllers" />
<!-- Enable annotation driven controllers, validation etc... -->
<mvc:annotation-driven />
<!-- Configures Handler Interceptors -->
<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors>
<!-- Application Message Bundle -->
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages/messages" />
<property name="cacheSeconds" value="1" />
</bean>
<!-- Saves a locale change using a cookie -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
Only relevant log file entry:
DEBUG Thread-1 org.springframework.web.context.support.XmlWebApplicationContext - Using MessageSource [org.springframework.context.support.ReloadableResourceBundleMessageSource: basenames=[/WEB-INF/messages/messages]]