2

I'm creating a modular JSF 2.0 application and each of the modules has their own faces-config and the facelet pages. These modules are packaged into JAR and consumed in a master JSF2 application. Everything works fine but the resource bundles defined in each of the faces-config files are not resolved at the runtime. Not resolved means the respective text is not displayed in the pages. I refer to the message as <h:outputText value="#{msg['message1']}" />

how do I make it work?

SashikaXP
  • 797
  • 1
  • 7
  • 22

3 Answers3

5

After some research it seems, resource-bundles defined in faces-config files in a JAR file are not resolved at run time. The only solution is to use <f:loadBundle var="msg" basename="messages"/> explicitly in the facelet page. Then it will resolve the messages.properties inside the JAR file.

SashikaXP
  • 797
  • 1
  • 7
  • 22
2

This is an old topic but maybe could help someone.

Another possible solution is to declare two different bundles in faces-config.xml. Something like that:

<application>
    <resource-bundle>
        <base-name>msgsprj</base-name>
        <var>msgsPrj</var>
    </resource-bundle>

    <resource-bundle>
        <base-name>msgsfmk</base-name>
        <var>msgsFmk</var>
    </resource-bundle>
</application>

So in your XHTML's you can use them this way:

#{msgsFmk['generic.msg.remove']}

As well it would be good idea to take a look at this topic:

Using Multiple Resource bundles in JSF

Claudiomir
  • 109
  • 1
  • 7
0

When packed as jar, faces-config.xml must be at /classes/META-INF/ dir, and it is not necessary to add the f:loadBundle in each facelet

Atul Dwivedi
  • 1,452
  • 16
  • 29