1

I'd like to retrieve a resource bundle string based on locale for a specific backing bean class. In *.jsf files I'd just use #{text['my.string']}. How do I do this in my backing bean class?

ty

joe
  • 28
  • 6
membersound
  • 74,158
  • 163
  • 522
  • 986
  • 2
    Using the class ... (drum roll) ResourceBundle? (http://docs.oracle.com/javase/6/docs/api/java/util/ResourceBundle.html) – JB Nizet Feb 26 '12 at 13:26

1 Answers1

3

ResourceBundle.getBundle("bundleName").getString("my.string")

Pay attention: bundleName is the name of properties file without the extension "properties". For example if you have file messages.properties you should call ResourceBundle.getBundle("messages")

AlexR
  • 111,884
  • 15
  • 126
  • 200