webtier@glassfish.java.net

Composite components in JSF 2.0 - Retargeted actionListeners

From: <webtier_at_javadesktop.org>
Date: Tue, 25 Nov 2008 05:42:06 PST

I was reading Ed Burns article on composite components in JSF 2.0 (http://blogs.sun.com/enterprisetechtips/entry/true_abstraction_composite_ui_components1) but I can't get it to work using GlassFish v2/v3 prelude and JSF 2.0

My client page contains a simple composite component (as can be found in the jsf-demo in the svn repo).
It registers an actionListener on the composite component, in order to process the action generated from the commandbutton inside the component.

<ez:loginPanel id="loginPanelInConsumingPage" model="#{bean}">
<f:actionListener for="loginEvent"
binding="#{bean.loginEventListener}" />
.....
</ez:loginPanel>

Composite component interface exposes the event via the actionSource element.

<composite:interface name="loginPanel"
displayName="Very Simple Login Panel"
preferred="true"
expert="false"
shortDescription="An illustration of the composite component feature">

<composite:actionSource name="loginEvent" />
...
</composite:interface>

The composite component implementation contains the commandButton that will generate the event :

<composite:implementation>
<h:commandButton id="loginEvent" value="Login"/>
</composite:implementation>

It seems that the retargeted actionlister doesn't end up in the component tree and as such the commandbutton doesn't invoke my actionlistener. (If my understanding is correct, the commandButton in the component implementation should have the actionListener associated to it that was defined in my client page).

The actionListener is getting processed by facelets (while debugging, I see that it gets added to the commandbutton via the facelets tag handlers - MultiViewHandler.retargetAttachedObjects).

No error occurs, the page just refreshes (like with an action-less commandButton)

I've tried it with the EDR 2 release, and with the 2.0 snapshots but can't get it to work.

Any ideas ?
[Message sent by forum member 'ddewaele' (ddewaele)]

http://forums.java.net/jive/thread.jspa?messageID=318633