Question

How can I do this? I want to show a value from a entity, not a string, but how can I do this as a valid code?

itemLabel="#{mandatoryFriendship.receiver == loginBean.currentMandatory ? mandatoryFriendship.sender.surname  : mandatoryFriendship.receiver.surname mandatoryFriendship.receiver.name}"

Thank you for you help

Pas de solution correcte

Autres conseils

Assuming at least EL 2.2 and that the names are non-null Strings you could have an expression of the form:

#{condition ? str0 : str1.concat(str2)}

For an older version (or null Strings) you could use:

#{condition ? str0 : str1}#{condition ? str0 : str2}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top