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

No correct solution

OTHER TIPS

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}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top