JEE7: Using Resources



  • Resource Bundles must be created under the resource directory

Create a new Resource Bundel with IntelliJ

Click on resources -> Right Click -> NEW -> Resource Bundle -> Provide a Bundle Name -> Add All Resources
Image resource_img1.jpg  NOT Found

Verifiy Resource Bundle Creation

Directory Layout after resource Bundle Creation
Image resource_img2.jpg  NOT Found

Configuring faces-config.xml under WEB-INF folder

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2" xmlns=""




Java Code testing Resource

@ManagedBean(name = "editor")
public class EditorBean {
    static  {
        System.out.println("Testing Resource Setup: ");
        try {
            Locale locale = Locale.getDefault();
            System.out.println("Testing Resource Setup - Current Locale: " + locale);
            ResourceBundle backend = ResourceBundle.getBundle("backend",locale);
            Enumeration  keys = backend.getKeys();
            while (keys.hasMoreElements()) {
                String key = keys.nextElement();
                String value = backend.getString(key);
                System.out.println("Testing Resource Setup:" + key + ": " + value);
        } catch (Exception e ){ e.printStackTrace();}



  Testing Resource Setup: 
  Testing Resource Setup - Current Locale: en_US
  Testing Resource Setup:MALE: Herr
  Testing Resource Setup:FEMALE: Frau