“找不到基本名称消息包”错误
运行我的应用程序时,我收到以下错误:
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。
我缺少什么?
while running my application I get the following error:
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)
In my faces-config I specified this:
<resource-bundle>
<base-name>messages</base-name>
<var>msg</var>
</resource-bundle>
and I have a directory src\web\resources\msg with the file messages_en.propeties.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据异常情况,服务器正在查找的区域设置为
de_CH
,如果失败,则为de
。如果也失败,那么它将寻找“默认”语言,但这是什么,取决于您的系统设置。所以它可能永远不会去messages_en.properties
。如果您想要的话,您可以提供messages.properties
(不带任何区域设置指示符)作为默认值。另请阅读此处,了解区域设置解析如何工作的完整说明:http://java.lang. sun.com/developer/technicalArticles/Intl/ResourceBundles/
Based on the exception, the locale that the server is looking for is
de_CH
or failing that,de
. If that fails too, then it will look for 'default' language, but what that is, depends on your system settings. So it may never even go tomessages_en.properties
. You could providemessages.properties
instead (without any locale indicator) to serve as a default, if that's what you want.Also read here for the full explanation of how the locale resolution works: http://java.sun.com/developer/technicalArticles/Intl/ResourceBundles/