[JAVASERVERFACES_SPEC_PUBLIC-1222] ValueChange method in POJO doesn't resolve correctly when POJO is a ui:param Created: 09/Apr/13  Updated: 13/Aug/14

Status: Open
Project: javaserverfaces-spec-public
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Thomas Lee Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS X 10.8.3


Attachments: Zip Archive cc-ui-param.zip    
Issue Links:
Related
is related to JAVASERVERFACES_SPEC_PUBLIC-1223 Facelet ui:param doesn't work in comp... Open

 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.



 Comments   
Comment by Thomas Lee [ 09/Apr/13 ]

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

Comment by Manfred Riem [ 09/Apr/13 ]

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

Comment by Thomas Lee [ 09/Apr/13 ]

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!

Comment by Thomas Lee [ 10/Apr/13 ]

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'
Comment by Thomas Lee [ 10/Apr/13 ]

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'.
Comment by Manfred Riem [ 30/Aug/13 ]

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.

Comment by Ed Burns [ 01/Aug/14 ]

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

Generated at Tue Sep 27 13:05:42 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.