0

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

0

3 Answers 3

1

Did you try this:

disabled="#{empty myBean.myList[label]}"
Sign up to request clarification or add additional context in comments.

3 Comments

Amr Gawish, thank you for your suggestion. I solved my issue, but your idea sounds well. Thank you
I'm glad you solved it, but if the answer I provided is also a valid answer, can you mark it as the right answer!
I found a solution before testing your approach. So, I put the link I followed to solve it. But thank you a lot again
0

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:

1 Comment

thank you for your suggestions, but they don't work for me. An EL Expression can't pass parameters when invoking a function, but there is a tricky idea to make something like that. Thank you again
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.