Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3219

EL inline expressions does not resolve cc as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0.8, 2.1.2
    • JSR-314
    • None

    Description

      Suppose this example:

      <testComposite:compositeRefVE value="success">
      </testComposite:compositeRefVE>

      compositeRefVE.xhtml

      <composite:interface>
      <composite:attribute name="value"/>
      </composite:interface>
      <composite:implementation>
      <testComposite:compositeRefVE2>
      <p>Some text: <h:outputText value="#

      {cc.attrs.value}"/> there.</p>
      </testComposite:compositeRefVE2>
      </composite:implementation>

      compositeRefVE2.xhtml

      <composite:interface>
      </composite:interface>
      <composite:implementation>
      <composite:insertChildren/>
      </composite:implementation>

      It works, everything is ok in this case. The final output is "Some text: success there.". But now change compositeRefVE.xhtml to this:

      <composite:interface>
      <composite:attribute name="value"/>
      </composite:interface>
      <composite:implementation>
      <testComposite:compositeRefVE2>
      <p>Some text: #{cc.attrs.value}

      there.</p>
      </testComposite:compositeRefVE2>
      </composite:implementation>

      It should do the same, but it does not work, because #

      {cc.attrs.value}

      is resolved to null. Why? There are two reasons:

      1. When the markup is executed, the current component on the stack is the inner one (compositeRefVE2), and it should be the outer one. This means the inner component must be pop and push. We didn't notice the effect in the other case, because Location object is used there to detect the current composite component.

      2. If #

      {cc}

      is used, the expression should be wrapped using LocationValueExpression, like on TagAttributeImpl

      Additionally, I saw we are not caching inline EL expressions, so this is a good oportunity to do it.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: