if and choose unusable in rich:dataTable
giant2 Mar 20, 2012 11:55 AMHi all!
Another strange thing for today!
I must create a table formed by 3 columns:
The first one is a label, the second one is a label, the third in a "special one". In this column I want to display a label following a rule on the bean.
To do this last feature I try to use a choose/when/otherwise construct like the following:
<c:choose>
<c:when test="#{bean.theTest=='ONE'}">
<h:outputText value="This is well covered" />
</c:when>
<c:when test="#{bean.theTest=='TWO'}">
<h:outputText value="This is covered" />
</c:when>
<c:otherwise>
<h:outpuText value="This is uncoveder" />
</c:otherwise>
</c:choose>
So the xhtml is about:
<rich:dataTable value="#{beanContainer.getBeans()}" var="bean">
<rich:column>
<f:facet name="header">Surname</f:facet>
<h:outpuText value="#{bean.surname}" />
</rich:column>
<rich:column>
<f:facet name="header">Name</f:facet>
<h:outpuText value="#{bean.name}" />
</rich:column>
<rich:column>
<f:facet name="header">Status</f:facet>
<c:choose>....</c:choose>
</rich:column>
</rich:dataTable>
The strange thing is that everytime the third column is "This is uncovered", so the otherwise option (but following data used in the where-test tell different thing. I tryed to display the value I test in the otherwise option and (as told before) I see the bean.theTest has a value of "ONE" or "TWO", so no otherwise whould follows! I do not understand!!!
I use the same piece of code in another xhtml of my project and all goes ok.
I even tryed to put an outputText with the result of the test and see it is correctly true or false following the data. But when it is used in the when-clause it goes KO!
The only difference between these two is that when is ok the choose is used in a s:div, but it doesn't function when it is used in a rich:dataTable and rich:extendedDataTable.
So I suspect it is a richfaces behavior.
P.S. The same thing is for "if" constructor. Seems test-clause is ignored!!! WHY!??!?!?!??