[英]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)
我究竟做錯了什么?
我找到了解決方案。
屬性文件應位於/ WEB-INF / classes下
嘗試添加更多這個:
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="classpath:messages"/>
</bean>
您的資源束必須在類路徑中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.