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

Facelets Compatibility: PropertyNotFoundException in nested components if attribute has same name as bean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0, 4.0.1
    • None
    • General
    • None
    • primefaces-test project, jakarta branch

    Description

      I apologize in advance if this one is a SOB to debug and hopefully fix. Maybe not though?

      Given the following nested component structure:

      panel (composite component) -> panel (taglib component) -> departmentInfo (composite component) -> outputIconText (composite component) -> icon (taglib component)

      The panel composite component and the panel taglib component have an attribute called "color". The departmentInfo component uses "color" in an EL expression, which is supposed to be a call to a named bean "Color":

      <?xml version="1.0" encoding="UTF-8"?>
      <ui:component xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:cc="http://xmlns.jcp.org/jsf/composite"
                    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                    xmlns:test="http://xmlns.jcp.org/jsf/composite/components">
          <cc:interface>
              <cc:attribute name="value"
                            required="true"
                            type="org.primefaces.test.Department"/>
          </cc:interface>
      
          <cc:implementation>
              <div id="#{cc.clientId}">
                  <test:outputIconText icon="#{icon.test} #{color.blue}"
                                       value="#{cc.attrs.value.name}"/>
              </div>
          </cc:implementation>
      </ui:component> 

      Somehow it seems to be interpreted as the attribute though, because the following exception occurs:

      Caused by: jakarta.el.PropertyNotFoundException: Property [blue] not found on type [java.lang.String]
          at jakarta.el.BeanELResolver$BeanProperties.get (BeanELResolver.java:251) 

      The exception occurs only using MyFaces (mvn clean jetty:run -Pmyfaces40) but works using Mojarra (mvn clean jetty:run -Pmojarra40). You can find my reproducer here: https://github.com/mkomko/primefaces-test/tree/expression-error-property-not-found

      Of course, org.apache.myfaces.STRICT_JSF_2_FACELETS_COMPATIBILITY is set to true but it does not matter in this case.

      Thank you very much in advance!

      Attachments

        Activity

          People

            Unassigned Unassigned
            mkomko Manuel K
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: