An EL Expression can't pass parameters when invoking a function, but I found this link which explain an idea to simulate a passing-parameters by using a Map. It works perfect for me: Pass parameters from EL to a method: Simulation
ADF EL: check if an item is contained in a list
-
07-10-2022 - |
Pergunta
I'm using JDeveloper 11.1.1.7.0
In the backing bean, I have a List attribute called myList, with related public and standard getter and setter methods, and I need to check if a String is contained inside it, in the context of an EL expression.
I have tried this expression:
disabled="#{myBean.myList.contains(label)}"
But it fails, and the message is that character ( has found instead of [ , . , or, eq, ...
I have tried to generate my custom TLD following this clear and well-explained steps How to create a custom EL function?, but I got an error becaus the function I declare is not found.
How can I check this condition (String contained in a List) in an EL expression? Thanks in advance. Regards
Solução 3
Outras dicas
Did you try this:
disabled="#{empty myBean.myList[label]}"
If you really have an attribute of type List
in your backing bean this should work.
You can also use it in the following ways:
disabled="#{myBean.myList.contains('the text')}"
disabled="#{not myBean.myList.contains(label)}" // contains not
disabled="#{myBean.myList.contains(label) eq true}"
disabled="#{!myBean.myList.contains(label)}" // contains not
If this doesn't work maybe something is wrong with your list.
See also: