0

I want to render different primefaces components based on thr string value. How to check if the string is empty in 'rendered' attribute?

Kukeltje
  • 12,085
  • 4
  • 21
  • 46

1 Answers1

2

You should use the empty EL operator:

<p:someComponent rendered="#{not empty suchBean.veryStringWow}"/>

<p:differentComponent rendered="#{empty suchBean.veryStringWow}"/>

If the bean String property is empty or null, the "different component" is rendered.

Selaron
  • 5,915
  • 4
  • 28
  • 38