The Eclipse Facelet HTML Validator reports an error "Cannot apply expression operators to method bindings" for the following line:
<ui:fragment rendered="#{!empty managedBean.getSomething('ENUM_VALUE', someInt)}">
I found this in the Juno help (I'm using Kepler):
Applying operator to method binding
#{bean.action * 5}
If bean.action indicates a method "action()" on bean, then it is not legal EL to treat its result as a value. In the example, multiplying action by 5 attempts treat it is as a value.
I'm having trouble understanding why it's not legal to treat its result as a value? What's the correct way to write the EL then? Thanks!
If you like you can hide the error message by setting
Window -> Preferences -> Web -> JavaServer Faces Tool -> Validation -> General Problems
the value Applying method operator to binding
to Ignore
.
Have you tried putting paranthesis around your method. Like this:
#{!empty (managedBean.getSomething('ENUM_VALUE', someInt))}
This way JSF evaluates the method and then checks for null or empty.
I am no expert in JSF, but I had the same problem in one of the similar expression:
#{some_method() == 0 and some_other_method() eq 'some value'}
I saw the same issue shown by Eclipse but the page was running correctly. After I put paranthesis around both of my expressions, Eclipse did not show that error.
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