I have this attribute in my h:commandButton
disabled="#{ not ( ( nodeChild.children == null or empty nodeChild.children ) and ( not setupManager.currentTerminals ) ) }"
If it renders disabled="false" everything works but 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 of writing the above condition? Can I use the brackets?
The #{setupManager.currentTerminals} is apparently returning an ArrayList and thus the expression #{not setupManager.currentTerminals} will fail because it's not a Boolean. Use the not empty instead of not. Here's a rewrite (note that empty covers null as well, you don't need to do a nullcheck before).
disabled="#{not empty nodeChild.children and not empty setupManager.currentTerminals}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With