Looking directly at the tag will be easier to understand my problem, the question goes inside the styleClass attribute:
<h:outputText value="#{prod.actualStock}"
styleClass="
#{productBean.getSeverity(prod.actualStock, prod.replacementAlertLevel).equals('INFO') ?
'severity-info' : productBean.getSeverity(prod.actualStock, prod.replacementAlertLevel).equals('WARN') ?
'severity-warn' : 'severity-danger'}" />
Now, note that I’m calling two times the ‘getSeverity()’ function, each of the three returns gives a different style class for the outputText. Is there a way to call the function only once keeping the same logic?
The ” tag goes inside a table.
Why not just have the getSeverity method return the class name as a string?