I’m using JSF, and I have to load a bundle called Extra.
<f:loadBundle basename="com.ni.lib.extra.delivery.ExtraBundle" var="extra" />
Inside that extra variable, there’s a value called downtime_notice. Now, if that value is NOT empty, I have to show a css segment with the text contained within the downtime_notice value. Something like this (of course this doesn’t work):
if(extra.donwtime_notice!=''){
<div class="pnx-msg pnx-msg-warning clearfix">
<i class="pnx-msg-icon pnx-icon-msg-warning"/>
<span class="pnx-msg-content"><h:outputText value="#{extra.downtime_notice}" escape="false"/></span>
</div>
</br>
}
I can use javascript, just in case.
Any ideas? Thanks!
You can use
<ui:fragment>or<h:panelGroup>to conditionally render content. You can use theemptykeyword in EL to check if a variable is not null or empty. So, all with all this should do:Or, using
<h:panelGroup layout="block">which renders a<div>already:Note that some may opt to use
<f:verbatim>for the job, but this tag is deprecated since JSF2.See also:
Unrelated to the concrete problem, the
</br>tag is invalid HTML, so I omitted it form the examples.