0

I have the following:

<c:set var="myMode" value="#{component.parent.attributes['xyz-mode']}"/>

where "xyz-mode" is from another composite component... when I print its value using this:

<p:outputLabel value="#{myMode}" /> 

It prints it correctly, suppose the value is 3 But..in the same page, when I use c:if or c:when.. it does not evaluate the value correctly:

<c:choose>    
    <c:when test="#{myMode == 3}">
         <p:outputLabel value="mode is 3" />
    </c:when>
    <c:otherwise>
         <p:outputLabel value="Otherwise" />
    </c:otherwise>
</c:choose>

The code prints the "Otherwise" case only.. not the "mode is 3" Please note that the type of "xyz-mode" that is retrieved from the composite component is Integer.. Why this is happening.. It has been 10 days now and I am not finding the answer :( .. can anyone help please? Appreciated.

Mazen Khalil
  • 56
  • 1
  • 5

1 Answers1

0

You can use rendered attribute to check the condition and print the value accordingly.

<p:outputLabel value="mode is 3" rendered="#{myMode == 3}" />
<p:outputLabel value="Otherwise" rendered="#{myMode != 3}" />

Hope it helps.

Chirag Patel
  • 500
  • 1
  • 6
  • 17