managed bean - show/hide piece of html on certain java value (JSF) -
i'm programming piece of code should display html if statement correct.
i have managed-bean contains values. status, enum - , i've found online treated string. however, not work me.
<c:if test="#{mybean.item.status == 'open'}" > //display </c:if> what best way display this? c:if doesn't work.
the <c:if> runs during view build time, moment when xhtml file converted jsf component tree, , not work if tested variable available during view render time, moment when jsf component tree needs generate html. need jsf component runs during view render time.
if intend render jsf component fragments conditionally during view render time, should using <ui:fragment>:
<ui:fragment rendered="#{mybean.item.status == 'open'}"> ... </ui:fragment> an alternative <h:panelgroup>:
<h:panelgroup rendered="#{mybean.item.status == 'open'}"> ... </h:panelgroup> it renders nothing html output long don't specify attribtues should end in html output id, style, etc. generate html <span> element. semantically @ least better <label> incorrectly suggested other answerer. <label> intented label associated html input element, not span markup.
Comments
Post a Comment