javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-1222

ValueChange method in POJO doesn't resolve correctly when POJO is a ui:param

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      OS X 10.8.3

      Description

      Normally a composite component can resolve a valueChange method in a POJO that is a property of managed bean.

      This is often used to pass a POJO to a <ui:include>:

      <ui:include src="part.xhtml">
          <ui:param name="pojo" value="#{managedColors.unmanaged}"/>
      </ui:include>
      

      The using page would be:

      <custom:list list="#{pojo.colors}"
                   selected="#{pojo.color1}"
                   valueChangeListener="#{pojo.onColorChange}">
          <f:ajax event="valueChange" execute="@this" render="@this"/>
      </custom:list>
      

      However, when the unmanaged bean (POJO) is passed as a <ui:param>, attempting to change the value will result in the following exception:

      javax.faces.event.AbortProcessingException
      /part.xhtml @10,62 valueChangeListener="#{pojo.onColorChange}":
      The class 'com.custom.beans.PojoColors' does not have the property 'onColorChange'.
      

      The valueChange method seems to only be resolved correctly be writing out the complete EL expression:

      <custom:list selected="#{managedColors.unmanaged.color1}"
                   list="#{managedColors.unmanaged.colors}"
                   valueChangeListener="#{managedColors.unmanaged.onColorChange}">
          <f:ajax event="valueChange" execute="@this" render="@this"/>
      </custom:list>
      

      A simple example project for NetBeans has been attached detailing this issue.

        Issue Links

          Activity

          Thomas Lee created issue -
          Hide
          Thomas Lee added a comment - - edited

          I can attach a sample project reproducing this issue once I have permissions to attach files.

          EDIT:
          Here's a link to a sample NetBeans project detailing the issue: https://www.dropbox.com/sh/ojdj6mbykzpxr9t/svlgMUzFw4

          Show
          Thomas Lee added a comment - - edited I can attach a sample project reproducing this issue once I have permissions to attach files. EDIT: Here's a link to a sample NetBeans project detailing the issue: https://www.dropbox.com/sh/ojdj6mbykzpxr9t/svlgMUzFw4
          Hide
          Manfred Riem added a comment -

          Please send your sample zip file to issues@javaserverfaces.java.net. Can you please try it on the latest 2.1 release? Thanks!

          Show
          Manfred Riem added a comment - Please send your sample zip file to issues@javaserverfaces.java.net. Can you please try it on the latest 2.1 release? Thanks!
          Hide
          Thomas Lee added a comment -

          I've sent the sample zip project.

          I've also reproduced this issue on the latest 2.1 release, which I believe is Implementation-Version: 2.1.20.

          I did this by replacing the 2.1.6-SNAPSHOT version of javax.faces.jar in

          /Applications/NetBeans/glassfish-3.1.2.2/glassfish/modules/javax.faces.jar

          and confirming the new version 2.1.20 was loading via

          FacesContext.class.getPackage().getImplementationVersion();

          Thanks for the fast responses!

          Show
          Thomas Lee added a comment - I've sent the sample zip project. I've also reproduced this issue on the latest 2.1 release, which I believe is Implementation-Version: 2.1.20 . I did this by replacing the 2.1.6-SNAPSHOT version of javax.faces.jar in /Applications/NetBeans/glassfish-3.1.2.2/glassfish/modules/javax.faces.jar and confirming the new version 2.1.20 was loading via FacesContext.class.getPackage().getImplementationVersion(); Thanks for the fast responses!
          Hide
          Thomas Lee added a comment -

          Just tried it on the latest javax.faces.jar 2.2.0-m13-SNAPSHOT and got the same type of error of:

          The class 'com.custom.beans.PojoColors' does not have the property 'onColorChange'
          
          Show
          Thomas Lee added a comment - Just tried it on the latest javax.faces.jar 2.2.0-m13-SNAPSHOT and got the same type of error of: The class 'com.custom.beans.PojoColors' does not have the property 'onColorChange'
          Hide
          Thomas Lee added a comment -

          Actually this doesn't seem to be a POJO issue, but something wrong with EL resolution on the ui:param in a composite component.

          I tried passing a managed bean in a ui:param and got a property not found type of exception as well:

          <ui:include src="part.xhtml">
             <ui:param name="managed" value="#{managedColors}" />
          </ui:include>
          
          <ui:composition ..>
              <custom:list list="#{managed.colors}"
                         selected="#{managed.color1}"
                         valueChangeListener="#{managed.onColorChange}">
                <f:ajax event="valueChange" execute="@this" render="@this"/>
            </custom:list>
          </ui:composition>
          

          Attempting to change the value results in the same type of error, except now it also occurs for a managed bean:

          The class 'com.custom.beans.ManagedColors' does not have the property 'onColorChange'.
          
          Show
          Thomas Lee added a comment - Actually this doesn't seem to be a POJO issue, but something wrong with EL resolution on the ui:param in a composite component. I tried passing a managed bean in a ui:param and got a property not found type of exception as well: <ui:include src= "part.xhtml" > <ui:param name= "managed" value= "#{managedColors}" /> </ui:include> <ui:composition ..> <custom:list list= "#{managed.colors}" selected= "#{managed.color1}" valueChangeListener= "#{managed.onColorChange}" > <f:ajax event= "valueChange" execute= "@ this " render= "@ this " /> </custom:list> </ui:composition> Attempting to change the value results in the same type of error, except now it also occurs for a managed bean: The class 'com.custom.beans.ManagedColors' does not have the property 'onColorChange'.
          Manfred Riem made changes -
          Field Original Value New Value
          Link This issue is related to JAVASERVERFACES-2839 [ JAVASERVERFACES-2839 ]
          Manfred Riem made changes -
          Attachment cc-ui-param.zip [ 52244 ]
          Manfred Riem made changes -
          Assignee Manfred Riem [ mriem ]
          Hide
          Manfred Riem added a comment -

          You have hit upon an area with respect to composite components and ui:include that has not been ironed out as much as needed. The problem is that the context of the ui:param is not available within a retargetted method expression. And as such the resolution of the value expression is unable to find the 'pojo' variable.

          You are aware that instead of using a ui:include you can pass a bean to a composite component as an attribute and then use the attribute to resolve to the valuenChange method?

          I am moving this to the spec issue tracker as the real issue still exists.

          Show
          Manfred Riem added a comment - You have hit upon an area with respect to composite components and ui:include that has not been ironed out as much as needed. The problem is that the context of the ui:param is not available within a retargetted method expression. And as such the resolution of the value expression is unable to find the 'pojo' variable. You are aware that instead of using a ui:include you can pass a bean to a composite component as an attribute and then use the attribute to resolve to the valuenChange method? I am moving this to the spec issue tracker as the real issue still exists.
          Manfred Riem made changes -
          Project javaserverfaces [ 10204 ] javaserverfaces-spec-public [ 10222 ]
          Key JAVASERVERFACES-2835 JAVASERVERFACES_SPEC_PUBLIC-1222
          Affects Version/s 2.1.6 [ 15346 ]
          Component/s composite components [ 14361 ]
          Manfred Riem made changes -
          Assignee Manfred Riem [ mriem ]
          Manfred Riem made changes -
          Link This issue is related to JAVASERVERFACES-2812 [ JAVASERVERFACES-2812 ]
          Manfred Riem made changes -
          Link This issue is related to JAVASERVERFACES-2839 [ JAVASERVERFACES-2839 ]
          Hide
          Ed Burns added a comment -

          Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          Show
          Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
          Ed Burns made changes -
          Priority Major [ 3 ] Trivial [ 5 ]
          Ed Burns made changes -
          Priority Trivial [ 5 ] Minor [ 4 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Thomas Lee
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: