Billydan
Billydan

Reputation: 485

Set the color of outputText, if it has a specific value

I have to show the change historic of a data base table, and i need to change the color if the data between two rows is different. So I need to do something like this.

<h:outputText value="#{historiqueMbean.region.designation}"
              style="if (region.designation!=regionBefore.designation) color:'red'"/>
<h:outputText value="#{historiqueMbean.regionBefore.designation}"
              style="if (region.designation!=regionBefore.designation) color:'red'"/>

Upvotes: 0

Views: 14912

Answers (2)

Blas
Blas

Reputation: 1

Easy -> <h:outputText id="display" style="color: white"/>

Upvotes: 0

Vaibs_Cool
Vaibs_Cool

Reputation: 6156

Try this

 <h:outputText value="#{historiqueMbean.region.designation}"  styleClass="#{(region.designation!=regionBefore.designation) ? 'red' : 'white'}"/>

Upvotes: 1

Related Questions