I would like my PrimeFaces p:badge
not to be visible when the value is zero or empty.
The following will display a badge with the value 0
:
<p:badge value="0">
<p:avatar label="Badge"/>
</p:badge>
And if I use an empty value an empty badge will be displayed:
<p:badge value="">
<p:avatar label="Badge"/>
</p:badge>
Using the rendered
attribute is no option as it will also hide the contents of the badge (the p:avatar
in this case):
<p:badge rendered="#{bean.value ne '0'}">
<p:avatar label="Badge"/>
</p:badge>