views:

1805

answers:

1

Hello, 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

+1  A: 

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.

ChrisAD
Did not answer the question, but was helpful any way excusse me while I go and delete 40+ <f:loadBundle :)
David Waters
hehe no problem =) This might solve your problem tho? Have you tried if Eclipse shows you the proper type aheads?
ChrisAD
I have made the change suggested as it makes the code cleaner, but it does not help eclipse. Eclipse is assuming that the ResourceBundle will be a property file and doe not do as the spec says to look for the class first then for the property file.
David Waters