代码' application.title'对于语言环境' en_US'

时间:2016-05-19 07:46:51

标签: java spring spring-mvc resourcebundle

我在src / main / resource文件夹中有我的属性文件。

  • messages.properties
  • messages_en.properties
  • messages_en_US.properties

下面是我的spring-servlet.xml文件中的条目。

<resources mapping="/resources/**" location="/resources/" />

<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="prefix" value="/" />
    <beans:property name="suffix" value=".jsp" />
</beans:bean>

<!-- Localization Settings -->
<beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <beans:property name="basename" value="classpath:messages" />
    <beans:property name="defaultEncoding" value="UTF-8" />
</beans:bean>
<beans:bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
    <beans:property name="defaultLocale" value="en" />
    <beans:property name="cookieName" value="appLocaleCookie"></beans:property>
    <beans:property name="cookieMaxAge" value="3600"></beans:property>
</beans:bean>
<interceptors>
    <beans:bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        <beans:property name="paramName" value="locale" />
    </beans:bean>
</interceptors>

<!-- Property place holder configuration -->
<beans:bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <beans:property name="location" value="classpath:config.properties" />
</beans:bean>

但我一直收到以下错误

javax.servlet.jsp.JspTagException: No message found under code 'application.title' for locale 'en_US'.
    at org.springframework.web.servlet.tags.MessageTag.doEndTag(MessageTag.java:200)
    at org.apache.jsp.login_jsp._jspx_meth_spring_005fmessage_005f0(login_jsp.java:224)

我确实用classpath尝试了basename值的所有内容,没有classpath,但没有任何效果。

0 个答案:

没有答案