I have a bean with field status
. Depending on status
value different css class should be applied to render it.
So, I need something like this (very far from real things pseudocode):
if status == "Approved"
cssClass = "green"
if status == "Rejected"
cssClass = "red"
<span class="cssClass">Some info</span>
I tried to apply jstl
but I can't make it work with facelets and jsf (but I heard that it is possible, maybe its truth). Here is the code:
<c:choose>
<c:when test="#{report.approved}">
<c:set var="statusClass" value="approved"/>
</c:when>
<c:when test="#{report.rejected}">
<c:set var="statusClass" value="rejected"/>
</c:when>
<c:when test="#{report.inProgress}">
<c:set var="statusClass" value="progress"/>
</c:when>
<c:when test="#{report.pendingHR}">
<c:set var="statusClass" value="pending"/>
</c:when>
</c:choose>
<span class="status ${statusClass}">#{report.formattedStatus}</span>
How should it be done with JSF/Facelets?