5

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..

digvijay
  • 361
  • 2
  • 4
  • 12

2 Answers2

5

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

Daniel
  • 36,833
  • 10
  • 119
  • 200
  • thanks.. hadn't placed the file under src.. but now i did.. inside a nice package structure. named the file Message.properties. Also i need to write **package.Messages** and not **package.messages**.. inside the faces-config.xml.. the 'M' matters. Writing it in details for some other helpless newbie like me out there – digvijay Jun 07 '12 at 07:36
  • You are welcome, I know about the `M` , it was a left over of copy/paste of your question :) – Daniel Jun 07 '12 at 07:47
  • cool.. not a problem.. was looking into your question.. Will have to learn about validators before i learn its influence.. Will be back with more questions later – digvijay Jun 07 '12 at 07:53
3

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

1337
  • 338
  • 1
  • 6