سؤال

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

لا يوجد حل صحيح

نصائح أخرى

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}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top