0

I am moving our JSF messages.properties outside the war so QA and ops people can modify messages without generating a new war.

I've created a JBoss 7 module and placed the messages.properties file in $JBOSS_HOME/modules/com/acme/revenue/main/messages.properties. I updated jboss-deployment-structure.xml to include

<module name="com.acme.revenue"/>

And I put a module.xml file in $JBOSS_HOME/modules/com/acme/revenue/main. It contains:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.acme.revenue">
    <resources>
        <resource-root path="."/>
    </resources>
</module>

This all works. In the java code I can call:

ResourceBundle bundle = ResourceBundle.getBundle("messages", Locale.getDefault());
bundle.getString("TargetingKey") 

and it returns the translated value "Income Targeting". However in the JSF .xhtml files code calls #{messages.TargetingKey} and it is not working because JSF doesn't seem to find the resource bundle.

Before the change the faces-config.xml contained the following and it worked fine:

<resource-bundle>
    <base-name>com.acme.revenue.messages</base-name>
    <var>messages</var>
</resource-bundle>

How can I fix this JSF declaration to find the bundle, and display the messages?

Thank you.

Steve L
  • 783
  • 3
  • 8
  • 15

1 Answers1

0

When you create the module you gave the name=com.acme.revenue this acts like a static import for the faces-config.xml so in the resource-bundle declaration you must put in the base-name only the file name of your properties file.

<resource-bundle>
    <base-name>messages</base-name>
    <var>messages</var>
</resource-bundle>
anusha
  • 2,087
  • 19
  • 31