Reputation: 288
I am using JSF and have made a custom servlet for loading images dynamically.
I want this servlet to pick up my image folder location i.e. "F:\photos\images\" from the resource bundle. How do I access my resource bundle defined in my faces-config? I do not want to hard code this value in the servlet :/
Upvotes: 2
Views: 3246
Reputation: 30025
Let's say you have a resource bundle defined like this:
<resource-bundle>
<base-name>/resources/bundle</base-name>
<var>bundle</var>
</resource-bundle>
In Java you can access this property file like this:
import java.util.ResourceBundle;
...
ResourceBundle rb = ResourceBundle.getBundle("/resources/bundle");
String val = config.getString(key);
Upvotes: 4