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

EL inline expressions does not resolve cc as expected

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: JSR-314
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: