【问题标题】:"Can't find bundle for base name messages" error“找不到基本名称消息的捆绑包”错误
【发布时间】:2011-10-25 08:39:44
【问题描述】:

在运行我的应用程序时出现以下错误:

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)

在我的 faces-config 中我指定了这个:

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

我有一个目录 src\web\resources\msg,其中包含文件 messages_en.propeties。

我错过了什么?

【问题讨论】:

    标签: java jsf-2


    【解决方案1】:

    根据例外情况,服务器正在寻找的语言环境是de_CH,否则,de。如果这也失败了,那么它将寻找“默认”语言,但那是什么,取决于您的系统设置。所以它甚至可能永远不会去messages_en.properties。如果您愿意,您可以提供 messages.properties(不带任何语言环境指示符)作为默认值。

    另请阅读此处以获取有关区域设置解析如何工作的完整说明:http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/

    【讨论】:

    • 是的,我忘记了默认值的messages.properties...谢谢
    猜你喜欢
    • 2018-01-04
    • 2011-01-06
    • 1970-01-01
    • 2016-06-13
    • 2016-05-02
    • 2014-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多