Is there any way to make a conditional formatting with convertNumber
?
i have a Table - one colomn displays a timespan in days. the problem:
it shows like
- 5 days
- 3 days
- 2 days
- 1 days
but i want it to show "1 day"
I am using this code
<h:column>
<f:facet name="header"><h:outputText value="Timespan" /></f:facet>
<h:outputText value="#{bean.days}">
<f:convertNumber pattern="0.## days" />
</h:outputText>
</h:column>
on an other part of the Application I use POI to export to an Excel Sheet. there i set a cell format that accomplishes that need
CellStyle dayStyle = wb.createCellStyle();
dayStyle.setDataFormat(format.getFormat("[=1]General \"day\";General \"days\""));
is there any way to do the same with jsf? i don't want to make it something like this:
<h:column>
<f:facet name="header"><h:outputText value="Timespan" /></f:facet>
<h:outputText value="#{bean.days}" rendered="#{bean.days != 1}">
<f:convertNumber pattern="0.## days" />
</h:outputText>
<h:outputText value="#{bean.days}" rendered="bean.days == 1" value="1 day" />
</h:column>
Thanks in advance