users@javaserverfaces.java.net

Problem with Message Bundle

From: <alex_at_j2anywhere.com>
Date: Thu, 8 Mar 2012 18:02:17 +0000 (GMT)

In my application I am trying to get labels out of a message bundle.
However rather then use constant key values I am using variables

<c:forEach var="emailAddress" items="${emailAddresses}">
...
<c:set var="labelKey" value="Contact_Label_${emailAddress.type}"/>
...
<h:outputText value="#{faces_translations[labelKey]}"/>
...
</c:forEach>

Most of the time this works correctly, but every so often when a page
is loaded some of the label are not processed correctly and the
following message is displayed:

???Contact_Label_???

It looks like the email.type does not return a value, however I added
some debug code to print out the value of email.type by including
${emailAddress.type} and saw that a value was returned.

Another thing I tried was to remove the value everytime before setting
it again inside the loop using <c:remove.../>. This resulted in the
following exception. I verified that I had the tag library included in
the WAR file. (jstl-api-1.2.jar and jstl-impl-1.2.jar as well as
javax.faces-2.1.7).

<c:remove> Tag Library supports namespace:
http://java.sun.com/jsp/jstl/core, but no tag was defined for name:
remove

Both these issues are really baffling. The label works most of the
time, but not consistently. The tag is defined in the included library,
but cannot be found.

Thanks in advance for any pointers.
Alex