gpt4 book ai didi

java.util.MissingResourceException : Can't find resource for bundle

转载 作者:行者123 更新时间:2023-11-30 04:20:47 26 4
gpt4 key购买 nike

我已经搜索过,但没有结果。运行 JSF 应用程序时,我在控制台中收到此错误。

我正在尝试按照教程将基本的 messages.properties 文件添加到我的计算器应用程序中。该教程说“如果您使用 Eclipse Java EE,请务必添加 resources/messages.properties 作为源文件夹。”

这是在应用程序的构建路径中吗?因为我已经尝试过了,但行不通。

我的属性文件的文件路径:ProjectName/WebContent/resources/messages.properties

如何在 faces-config.xml 中引用属性文件:

<application>
<message-bundle>/JavaServerFaces/WebContent/resources/messages</message-bundle>
</application>

我的 faces-config.xml 的文件路径:ProjectName/WebContent/WEB-INF/faces-config.xml

最佳答案

捆绑文件必须最终位于类路径中,并且需要被标识为类路径资源,而不是本地磁盘文件系统路径或 Web 资源。

  • 创建包 resources与您为 Java 代码创建包的位置和方式相同。
  • 删除messages.properties文件放在那里。
  • 将其引用为 <message-bundle>resources.messages</message-bundle> .

关于java.util.MissingResourceException : Can't find resource for bundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17108964/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com