JSF Validation not finding custom ResourceBundle class

David Waters picture David Waters · Mar 20, 2009 · Viewed 10.1k times · Source

I have a custom ResourceBundle class org.example.web.UILabels.java which works well in running code but the JSF editor in Eclipse is not finding it, I assume the editor/validator is only looking for properties files by the name. This also means I no longer get type ahead find on the resources which was very nice to have.

Any ideas how this could be rectified?

<f:loadBundle basename="org.example.web.UILabels" var="uiLabels"/>
...
<h:outputText value="#{uiLabels.someTextValue}" />
...

I am getting the error message (in the problems error list)

Resource bundle org.example.web.UILabels cannot be found on classpath

Type=JSF Problem

Eclipse3.4.0 with WebStandardTools Versions

  • Version:1.4.0.v200802280619-13-7w311917141518
  • Version:1.5.1.v200802280619-1407w311917141519
  • Version:3.0.0.v200806092130-7A-8Y8QqN2lf4VSWrI2ek5Pf4k7s

For more about why I am using a ResourceBundle class instead of just a properties file see Question 653682 how-to-override-some-resources-from-a-propertyresourcebundle

Thanks for your time, David Waters

Answer

Chris Dale picture Chris Dale · Mar 20, 2009

The resource-bundle element is more efficient than the f:loadBundle action since the bundle can be created once for teh entire application. However its a JSF 1.2 feature and if u want to be compatible with JSF 1.1 you must use JSF 1.1. Heres an example if your using JSF 1.2: Define it in your faces-config.xml like this:

<application>
<resource-bundle>
<base-name>org.example.web.UILabels</basename>
<var>uiLabels</var>
</resource-bundle>
</application>

Sorry for not answering your question, but I dont have first hand experience with Eclipse. I also misunderstood your question first, therefor Ive edited my original answer.