0

My facelet is not able to get the properties of the property file, and I can't figure out why.

Code:

Facelet:

<th id="leaderLabel" class="label"><h:outputText value="#{msgs.fuehrer}" /></th>

Faces-config:

<faces-config version="2.0"
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">

    <application>
      <locale-config>
        <default-locale>de</default-locale>
        <supported-locale>en</supported-locale>
      </locale-config>
      <resource-bundle>
        <base-name>messages</base-name>
        <var>msgs</var>
      </resource-bundle>
    </application>
</faces-config>

Properties which I've placed in Maven project's src/main/resources:

messages_de.properties

fuehrer=Führer

messages_en.properties

fuehrer=Leader

Problem:

It does not render the text, it doesnt show it at all.

Jakob Abfalter
  • 4,980
  • 17
  • 54
  • 94
  • Apparently the properties files are not in the classpath. Where exactly did you put the files? See further also http://stackoverflow.com/questions/2668161/when-to-use-message-bundle-and-resource-bundle/ for hints. – BalusC May 09 '13 at 14:33
  • I have the properties in the src/main/resources folder. I already tried to put them at any possible place, but wont work – Jakob Abfalter May 09 '13 at 14:45
  • Uh uh, thus you're using Maven? Have you made sure that the contents of this folder ends up in the root of the runtime classpath? – BalusC May 09 '13 at 14:46
  • Yes i am using Maven. – Jakob Abfalter May 09 '13 at 14:46
  • I guess you mean the target folder which is created by Maven. So yes the .properties files are in target\classes which should be right I think? – Jakob Abfalter May 09 '13 at 14:48
  • Sorry, I'm no Maven expert. All I can tell is that it looks fine from the JSF perspective. Good luck. – BalusC May 09 '13 at 14:53
  • Please see [JSF 2 Internationalization Example](http://www.mkyong.com/jsf2/jsf-2-internationalization-example/). I would suggest to add the `messages.properties` as a default. – Charlee Chitsuk May 10 '13 at 01:15

0 Answers0