Discussion:
Composite Components and setPropertyActionListener
Drayton Brown
2011-08-31 16:01:12 UTC
Permalink
Hi All

I've created a composite component as follows:

<cc:interface>

...
<cc:attribute name="cctarget"/>
...

</cc:interface>

<cc:implementation>

...

<h:commandLink action="#{cc.attrs.ccaction}">

...

<f:setPropertyActionListener value="item" target="#{cc.attrs.cctarget}"/>

...

</h:commandLink>
...

</cc:implementation>

However when I click on the commandLink above, I get an error message as
follows:

javax.el.PropertyNotFoundException:
/resources/components/componentpanel.xhtml @24,113
target="#{cc.attrs.cctarget}": Target Unreachable, identifier 'cc' resolved
to null

I've had a look online for some examples and the closest I can find is this
example:
http://jamesgdriscoll.wordpress.com/2010/02/09/a-final-look-at-the-switchlist-jsf-2-component/
However in this example the composite component is tightly coupled to
the implementation of the 'switchlistController', which kind of defeats the
point.

Is anyone able to help me out with this?

Thanks in advance!

Regards
Drayton
Kito Mann
2011-09-05 21:02:32 UTC
Permalink
I think you've run into this bug:
http://java.net/jira/browse/JAVASERVERFACES-2009.
Passing a parameter to the action method using the Unified EL might work:

<h:commandLink action="#{cc.attrs.ccaction(cc.attrs.cctarget)}">
---
Kito D. Mann | twitter: kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter:
jsfcentral
+1 203-404-4848 x3

* Listen to the latest headlines in the JSF and Java EE newscast:
http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast
* Keep up with the aftermath of the Oracle/Sun merger:
http://www.mergerspeak.com
Post by Drayton Brown
Hi All
<cc:interface>
...
<cc:attribute name="cctarget"/>
...
</cc:interface>
<cc:implementation>
...
<h:commandLink action="#{cc.attrs.ccaction}">
...
<f:setPropertyActionListener value="item" target="#{cc.attrs.cctarget}"/>
...
</h:commandLink>
...
</cc:implementation>
However when I click on the commandLink above, I get an error message as
target="#{cc.attrs.cctarget}": Target Unreachable, identifier 'cc' resolved
to null
I've had a look online for some examples and the closest I can find is this
http://jamesgdriscoll.wordpress.com/2010/02/09/a-final-look-at-the-switchlist-jsf-2-component/
However in this example the composite component is tightly coupled to
the implementation of the 'switchlistController', which kind of defeats
the point.
Is anyone able to help me out with this?
Thanks in advance!
Regards
Drayton
Loading...