Thanks ould

On 5/16/06, ould neman <[EMAIL PROTECTED]> wrote:
Hasnain Badami a écrit :
> Hi
>
> I have a .properties file defined in my project in which I have
> messages of my application. I am using the following code to load the
> bundle in my application
>
> ArrayList<Cell> valueBindedArrayList = new ArrayList<Cell>();
>   String bundleName = fc.getApplication().getMessageBundle();
>   System.out.println("bundle name is " + bundleName);
>   Locale locale = fc.getApplication().getDefaultLocale();
>   ResourceBundle bundle = ResourceBundle.getBundle (bundleName, locale);
>
> But on executing the system print shows that the bundle name is null.
> Can there be any configuration problems. The properties file is in a
> package called resource.
>
> Any help shall be highly appreciated
>
> Thanks
>
> Hassnain
I use this code and I get my resource bundle

FacesContext fc = FacesContext.getCurrentInstance();
   ResourceBundle f = ResourceBundle.getBundle(fc.getApplication()
           .getMessageBundle(), fc.getViewRoot().getLocale());

but you must put this code in your faces-config.xml :
<application>
<locale-config>
  <default-locale>fr</default-locale>
  <supported-locale>fr</supported-locale>
  <supported-locale>en_US</supported-locale>
  <supported-locale>de</supported-locale>
</locale-config>
<message-bundle>folder1.folder2.authentification</message-bundle>
</application>

good luck

Reply via email to