You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Manuel K (Jira)" <de...@myfaces.apache.org> on 2023/03/08 07:55:00 UTC

[jira] [Created] (MYFACES-4589) PropertyNotFoundException in nested components if attribute has same name as bean

Manuel K created MYFACES-4589:
---------------------------------

             Summary: PropertyNotFoundException in nested components if attribute has same name as bean
                 Key: MYFACES-4589
                 URL: https://issues.apache.org/jira/browse/MYFACES-4589
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 4.0.0, 4.0.1
         Environment: primefaces-test project, jakarta branch
            Reporter: Manuel K


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":
{code:java}
<?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> {code}
 

Somehow it seems to be interpreted as the attribute though, because the following exception occurs:
{code:java}
Caused by: jakarta.el.PropertyNotFoundException: Property [blue] not found on type [java.lang.String]
    at jakarta.el.BeanELResolver$BeanProperties.get (BeanELResolver.java:251) {code}
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]

 

Thank you very much in advance!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)