Uploaded image for project: 'Seam Faces'
  1. Seam Faces
  2. SEAMFACES-208

Support for resolving no argument methods in an EL value expression

    Details

      Description

      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:

      public Integer count() {
          return 1;
      }
      

      If we attempt to resolve this in a value expression using:

      #{bean.count()}
      

      We can an error message "count property not found on bean"

      It works as expected if the method has at least one parameter:

      public Integer count(Integer i) {
          return i;
      }
      

      The following expression will resolve to a value of 1.

      #{bean.count(1)}
      

      This also breaks resolving the size of a collection:

      #{employees.size()}
      

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lightguard Jason Porter
                  Reporter:
                  dan.j.allen Dan Allen
                • Votes:
                  3 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: