Read resource bundle properties in a managed bean

后端 未结 3 403
时光取名叫无心
时光取名叫无心 2020-11-28 09:57

Using files I\'m able to have i18n text in my JSF pages.

But is it possible to access these same properties in my managed bean

3条回答
  •  一生所求
    2020-11-28 10:55

    Another possibility:

    faces-config.xml

    
    
      
        
          de
        
        
          de.fhb.resources.text.backend
          backendText
        
      
    
    

    YourBean.java

    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    ResourceBundle backendText = app.getResourceBundle(context, "backendText");
    backendText.getString("your.property.key");
    

提交回复
热议问题