0

I came across some .xhtml files where for some components the expression language used was like rendered="#{empty from}", rendered="#{empty create}" etc.

I know that empty is an operator in EL, used to check whether a value is null or empty, but I did not understand the meaning of above mentioned ELs.

Can somebody explain to me what above EL's mean?

Charles
  • 50,943
  • 13
  • 104
  • 142
Newbie
  • 2,979
  • 9
  • 34
  • 41

1 Answers1

1

The rendered attribute is a signal whether JSF should generate HTML for the component or not. If it evaluates false, then it won't generate HTML for the component (nor for its children). The #{empty form} will evaluate false when the #{form} is not null nor empty.

Simple as that. You can find another examples of boolean expressions here: Conditionally displaying JSF components

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I know the behavior of rendered attribute and usage of empty operator. But I am not able to understand what `from`,`create` words mean. Does these have some special meaning? – Newbie Feb 05 '13 at 12:12
  • It are just variables in EL scope, like managed beans or view/template parameters. You can name them whatever you want. The `#{form}` could for instance be just a `@Named @Produces public Form getForm()` or an ``. – BalusC Feb 05 '13 at 12:12