1
votes

i'm developing a custom jsf component a want to store messages i a properties file and want get messages stored in it by java code. Must i config faces-config? and how to get message bundle??

1

1 Answers

1
votes

Just drop it in classpath and use java.util.Properties or java.util.ResourceBundle for configuration settings or localized content respectively. Here are examples assuming that you've dropped the filename.properties file in com.example package.

Properties properties = new Properties();
properties.load(Thread.currentThread().getContextClassLoader().getResource("com/example/filename.properties"));
// ...

or

ResourceBundle bundle = ResouceBundle.getBundle("com.example.filename");
// ...