Thursday, 8 August 2013

Hiding JSF elements with Java

Hiding JSF elements with Java

The java code returns a column from a SQL query and if the item isn't
null, sets the title to "Available".
String sppAcronym = results.getString("ACRONYM");
if (sppAcronym != null) {
sp.setFireStudyTitle("Available");
}
The JSF code makes a button labeled "Available" for all of the non-null
items.
<h:column headerClass="columnHeader" footerClass="columnFooter"
itemValue="0">
<f:facet name="header">Link to FEIS Fire Studies</f:facet>
<h:commandButton id="btnSearch" value="#{SPP.fireStudyTitle}"
action="#{searchBean.doMagic(SPP.acronym)}"
immediate="true" onchange="submit();"
style="font-weight:bold; font-size:small;"
onclick="javascript:cursor_wait()" class="buttonsFEIS"/>&#160;&#160;
</h:column>
My problem is that JSF makes small, empty commandButtons even for the null
items.
How can I make it so I can hide those empty commandButtons and display
only the non-null items?

No comments:

Post a Comment