Jsf 2.0 expression language brackets do not work

I have this attribute in my h: commandButton

disabled="#{ not ( ( nodeChild.children == null or empty nodeChild.children ) and ( not setupManager.currentTerminals ) ) }"

If it displays disabled="false", everything works, and the other throws this exception

SEVERE: javax.faces.FacesException: java.lang.IllegalArgumentException: Cannot convert [] of type class java.util.ArrayList to class java.lang.Boolean

What is the best way to write the above condition? Can brackets be used?

+3
source share
1 answer

#{setupManager.currentTerminals}apparently returns ArrayList, and therefore the expression #{not setupManager.currentTerminals}will fail because it is not a Boolean. Use not emptyinstead not. Rewrite here (note that this emptyalso covers null, you don't need to do nullcheck before).

disabled="#{not empty nodeChild.children and not empty setupManager.currentTerminals}"
+5
source

All Articles