Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to declare an external JSF resource bundle when it resides in JBoss 7 module

2656887Apr 17 2014

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.

This same question was cross posted to java - How to declare JSF resource bundle when it resides in JBoss 7 module? - Stack Overflow

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2014
Added on Apr 17 2014
0 comments
1,659 views