The EL specification added support for resolving parameterized methods in value and method expressions, with one exception. It does not support resolving methods with 0 parameters. The reason is that an () used at the end of a property is not acknowledged. As a result, the resolver attempts to resolve the method name as a bean property.
For example, assume we have the method:
If we attempt to resolve this in a value expression using:
We can an error message "count property not found on bean"
It works as expected if the method has at least one parameter:
The following expression will resolve to a value of 1.
This also breaks resolving the size of a collection:
In this case, the error is a bit strange because it tries to parse size as an index.
The root cause of all this is that the spec does not properly honor 0 parameters as a valid number of parameters for a parameterized methods. Instead, it ignores the () and treats the expression as a property.
Method expressions does not have this limitation since both .action and .action() are equivalent expressions.