簡體   English   中英

Spring Web MVC:國際化/本地化:找不到消息

[英]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)

我究竟做錯了什么?

項目目錄 調度員servlet.xml中

我找到了解決方案。

屬性文件應位於/ 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM