I'm trying to use a conditional expression in an el expression used in jsf, but it does not work.
<h:outputText value="#{(sel.description !=null) && (sel.description !='') ? sel.description : 'Empty description'} - "/>
but it does not work, the compiler says:
Error Traced[line: 118] The entity name must immediately follow the '&' in the entity reference.
Do you have any suggestions? Thank you!
The words employ and utilize are common synonyms of use.
verb (used with object), used, us·ing. to employ for some purpose; put into service; make use of: to use a knife. to avail oneself of; apply to one's own purposes: to use the facilities. to expend or consume in use: We have used the money provided.
noun. the act of employing, using, or putting into service: the use of tools. the state of being employed or used. an instance or way of employing or using something: proper use of the tool; the painter's use of color. a way of being employed or used; a purpose for which something is used: He was of temporary use.
“Get Used to It”—How To Use It Correctly Horseback riding has been frightening for me, but I will get use to it. Horseback riding has been frightening for me, but I will get used to it. Here's a tip: Avoid writing I am use to it or Get use to it. Always include the d: I am used to it and Get used to it.
You seem to be using Facelets (which is perfectly fine). It's however a XML based view technology. Everything which you write in Facelets has to be syntactically valid XML. The &
is in XML a special character denoting the start of an entity like &
, <
, >
,  
, etc.
If you would like to represent the &
as-is in XML, then you'd have to replace it by &
.
<h:outputText value="#{(sel.description !=null) && (sel.description !='') ? sel.description : 'Empty description'} - "/>
However, that's not pretty readable, you would rather like to use the alternative EL operator and
for this (see also operators in EL for an overview of all available operators in EL):
<h:outputText value="#{(sel.description !=null) and (sel.description !='') ? sel.description : 'Empty description'} - "/>
All with all, this is in turn pretty clumsy as there's a simpler empty
keyword for the purpose of testing both nullness and emptiness. This can in your particular case be used as:
<h:outputText value="#{not empty sel.description ? sel.description : 'Empty description'} - "/>
or
<h:outputText value="#{!empty sel.description ? sel.description : 'Empty description'} - "/>
or
<h:outputText value="#{empty sel.description ? 'Empty description' : sel.description} - "/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With