glassfish
  1. glassfish
  2. GLASSFISH-20778

EL 3.0 doesn't behave in Glassfish 4 the same way as in the standalone API

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      windows 7, Dell Inspiron

      Description

      While writing some examples using the new features of Expression Language 3.0 (both in JSP and using the standalone API) I noticed that some of the new stuff are not behaving the same way in both places:

      1- According to item 1.22 of EL spec, "A static field or static method of a Javaclass can be referenced with the syntax classname.field, such as Boolean.TRUE".
      Doing so in the standalone API, it works as expected:

      ELProcessor elp = new ELProcessor();
      Object ret = elp.eval("Boolean.TRUE");
      System.out.println("Output Value: " + ret);

      Resulting: "Output Value: true"

      or...

      ELProcessor elp = new ELProcessor();
      Object ret = elp.eval("(x -> Math.sqrt)(9)");
      System.out.println("Output Value: " + ret);

      prints: 9.0

      However, when doing the same thing in JSP, nothing is printed:

      $

      {Boolean.TRUE}

      $

      {Integer.MAX_VALUE}

      $

      {Boolean.TRUE == true}

      // prints 'false'
      $

      {(x -> Math.sqrt(x))(9)}

      2 - According to item 1.22.3 of EL spec, "A class name reference, followed by arguments in parenthesis, such as Boolean(true) denotes the invocation of the constructor of the class with the supplied arguments."
      Doing so using the standalone API:

      ELProcessor elp = new ELProcessor();
      Object ret = elp.eval("StringBuilder('Java EE rocks')");
      System.out.println("Output Value: " + ret);

      Prints: Output Value: Java EE rocks

      But, in JSP:

      $

      {StringBuilder('Java EE rocks')}

      Results:

      exception
      org.apache.jasper.JasperException: javax.el.ELException: Expression uses
      functions, but no FunctionMapper was provided root cause

      *javax.el.ELException: Expression uses functions, but no FunctionMapper was
      provided*

      These expressions I have mentioned above wouldn't be supposed to work the same way in JSP and in the standalone API?

        Activity

          People

          • Assignee:
            kchung
            Reporter:
            marcelocenerine
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: