Search code examples
jsf-2resourcebundlemessage-bundle

Override my own resource bundle entry


In JSF, it's easy to override Messages from the default resource bundle:

javax.faces.component.UIInput.REQUIRED = {0}: Please enter value

I would like to use the same mechanism for my own library containing JSF resource bundles, composite components and utility classes. In this library I define a bundle:

<resource-bundle>
    <base-name>amed</base-name>
    <var>am</var>
</resource-bundle>

And in my webapp which uses this library:

a) default case

#{am['key']} fetches the value from the library (OK)

b) special case where I try to override the property from the library in another resource bundle:

<resource-bundle>
    <base-name>webappbundle</base-name>
    <var>wb</var>
</resource-bundle>


#{am['key']} should fetch the overritten property from webappbundle (DOES NOT WORK)

I know, it's not the right way to solve the problem but perhaps you understand my question and can give me an alternative solution.

BTW: I don't want to override a complete bundle, only some keys...


Solution

  • OK, it's not possible to override only some keys of a ResourceBundle. But you can override complete bundles.