java.util.MissingResourceException: Can't find bundle for base name messages, locale en_US

一世执手 提交于 2019-12-07 06:36:47

问题


I am new to JSF an was trying out this piece of code.. This is my faces-config.xml:

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

messages is a file that stores a few properties and messages file is not placed under any directory, it is placed directly under the application. Why cant i access this file? Thank you in advance.. please do let me know if you need any additional information..


回答1:


looks like your file placed in some package inside your src folder

<base-name>some.package.name.Messages</base-name>

also make sure the file called Messages.properties

b.t.w are you aware that Messages.properties file will allow you to override your validators error messages?

Also, take a look at this nice tutorial JSF 2 message and messages example




回答2:


If you put it in directly into src folder it should work. Athough I would suggest to organize the message files in packages.



来源:https://stackoverflow.com/questions/10927032/java-util-missingresourceexception-cant-find-bundle-for-base-name-messages-lo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!