Spring Web MVC:Internationalization/Localization:未找到消息

Spring Web MVC: Internationalization/Localization : No message found

我好像找不到国际化的来源。 我收到以下错误:

javax.servlet.jsp.JspTagException: No message found under code 'label.firstname' for locale 'en'.

在我的 jsp 我做的是:

<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<h1 class="page-header"><spring:message code="label.firstname"/></h1>

在 message.properties 中都有一个密钥对:

label.firstname=First Name (messages_en.properties)
label.firstname=Voornaam (messages_nl.properties)

我做错了什么?

尝试添加更多:

<bean id="messageSource"
    class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basename" value="classpath:messages"/>
</bean>

您的资源包必须在您的类路径中。

我找到了解决方案。

属性文件应该在 /WEB-INF/classes