2011-10-25 66 views
4

在運行我的應用程序出現以下錯誤:「找不到捆綁的基本名稱消息」錯誤

<resource-bundle> 
    <base-name>messages</base-name> 
    <var>msg</var> 
</resource-bundle> 

我:我指定該

javax.el.ELException: /view/doi/common/navigation.xhtml: Can't find bundle for base name messages, locale de_CH 
at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90) 
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) 
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302) 
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) 
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) 

在我的臉上,配置具有文件messages_en.propeties的目錄src \ web \ resources \ msg。

我錯過了什麼?

回答

4

根據例外情況,服務器正在尋找的區域設置爲de_CH或者失敗,de。如果這也失敗了,那麼它會查找'默認'語言,但是這取決於您的系統設置。所以它可能永遠不會去messages_en.properties。您可以提供messages.properties(沒有任何區域設置指示符)作爲默認設置,如果這是您想要的。

這裏還有閱讀的本地化解析如何工作的完整說明:http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/

+0

是的,我忘了有默認值messages.properties ...感謝名單 – Francesco

相關問題