Fun with OGNL conditionals

And by fun, I mean annoyance. On our project, we typically make implicit method references in our OGNL, e.g.

@Component(type="TextField", bindings={"disabled=ognl:conditionMet", "value=ognl:object.member"})
public abstract TextField getSomeTextField();
public boolean isConditionMet() {
    return true;
}

This generally works fine on our developer machines (Windows/Jboss). However, we recently ran into an issue on the deployment environment (AIX/Websphere) where fields were disabled when they should have been enabled. This initially puzzling issue was resolved by making the method references explicit, i.e.

@Component(type="TextField", bindings={"disabled=ognl:isConditionMet()", "value=ognl:object.member"})
public abstract TextField getSomeTextField();

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply