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,223
  • 4
  • 24
  • 47
AnilKS
  • 1
  • 1
  • 2

1 Answers1

3

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
  • 6,105
  • 4
  • 31
  • 39