dev@javaserverfaces.java.net

Re: Composite Components and setPropertyActionListener

From: Kito Mann <kito.mann_at_virtua.com>
Date: Mon, 5 Sep 2011 17:02:32 -0400

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
On Wed, Aug 31, 2011 at 12:01 PM, Drayton Brown <draytonbrown_at_gmail.com>wrote:
> 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
>
>