Skip to main content

Composite components in JSF 2.0 - Retargeted actionListeners

9 replies [Last post]
ddewaele
Offline
Joined: 2008-11-19
Points: 0

I was reading Ed Burns article on composite components in JSF 2.0 (http://blogs.sun.com/enterprisetechtips/entry/true_abstraction_composite...) 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.

.....

Composite component interface exposes the event via the actionSource element.

...

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

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 ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Ed Burns

>>>>> On Tue, 25 Nov 2008 05:42:06 -0800 (PST), webtier@javadesktop.org said:

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

IO> I can only confirm, that it didn't work for me too. (Same Setup)
IO> Later today I plan on trying that with a build from svn trunk. I
IO> will let you know if I had any success.

>>>>> On Tue, 2 Dec 2008 19:41:04 -0800, Ed Burns said:

EB> I am able to reproduce this problem and am working on it now.

EB> It's a subtle bug and I'm very glad you found it!

I have checked in the fix. Please find attached a zip file of a webapp
that shows the fix. It's a maven war project and you'll probably have
to fix the dependencies to make it build, but maybe not.

Thanks to Imre for reviewing the fix.

Thanks again!

Ed

[test.zip]

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

ddewaele
Offline
Joined: 2008-11-19
Points: 0

Thanks for the quick fix ... indeed a subtle bug :)

Everything is working fine now.....

The composite components was one of the new features in JSF 2.0 that I found very interesting and I wanted to see it in action...

We're currently preparing an upgrade of all of our JSF webapps (currently still at JSF 1.1 due to JDK / J2EE container limitations) and I wanted to get a sneak preview of the 2.0 release (although we're most likely going to upgrade to JSF 1.2).

Can you tell me if JSF 2.0 will be dependent on any features in the JEE6 spec, or will it be able to run on JEE5 certified containers available today ?

Ed Burns

>>>>> On Wed, 03 Dec 2008 08:42:47 -0800 (PST), webtier@javadesktop.org said:

DD> Thanks for the quick fix ... indeed a subtle bug :) Everything is
DD> working fine now.....

Awesome, thanks for verifying!

DD> The composite components was one of the new features in JSF 2.0 that
DD> I found very interesting and I wanted to see it in action...

DD> We're currently preparing an upgrade of all of our JSF webapps
DD> (currently still at JSF 1.1 due to JDK / J2EE container limitations)
DD> and I wanted to get a sneak preview of the 2.0 release (although
DD> we're most likely going to upgrade to JSF 1.2).

DD> Can you tell me if JSF 2.0 will be dependent on any features in the
DD> JEE6 spec, or will it be able to run on JEE5 certified containers
DD> available today ? [Message sent by forum member 'ddewaele'
DD> (ddewaele)]

JSF 2.0 will run on Java EE 5, though not all features will be available
in that environment. Thankfully, at this point in time there are no
Java EE 6 features that we depend upon so *all* of JSF 2.0 works under
Jave EE 5, but this could change if they come up with a feature that we
really need!

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Jan-Kees van Andel

> DD> We're currently preparing an upgrade of all of our JSF webapps
> DD> (currently still at JSF 1.1 due to JDK / J2EE container limitations)
> DD> and I wanted to get a sneak preview of the 2.0 release (although
> DD> we're most likely going to upgrade to JSF 1.2).
>
> DD> Can you tell me if JSF 2.0 will be dependent on any features in the
> DD> JEE6 spec, or will it be able to run on JEE5 certified containers
> DD> available today ? [Message sent by forum member 'ddewaele'
> DD> (ddewaele)]
>
> JSF 2.0 will run on Java EE 5, though not all features will be available
> in that environment. Thankfully, at this point in time there are no
> Java EE 6 features that we depend upon so *all* of JSF 2.0 works under
> Jave EE 5, but this could change if they come up with a feature that we
> really need!

I think this is a very interesting one. How will other Java EE6
features like Bean Validation and Web Beans be used in JSF?

Is it going to be some kind of SPI, making them pluggable or is JSF
going to have compile time dependencies on those frameworks?

After all, Web Beans is one of the things many people will probably
"really need". :-)

Regards,
Jan-Kees

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Ed Burns

>>>>> On Wed, 03 Dec 2008 21:12:14 +0100, Jan-Kees van Andel said:

DD> We're currently preparing an upgrade of all of our JSF webapps
DD> (currently still at JSF 1.1 due to JDK / J2EE container limitations)
DD> and I wanted to get a sneak preview of the 2.0 release (although
DD> we're most likely going to upgrade to JSF 1.2).
>>
DD> Can you tell me if JSF 2.0 will be dependent on any features in the
DD> JEE6 spec, or will it be able to run on JEE5 certified containers
DD> available today ? [Message sent by forum member 'ddewaele'
DD> (ddewaele)]
>>
>> JSF 2.0 will run on Java EE 5, though not all features will be available
>> in that environment. Thankfully, at this point in time there are no
>> Java EE 6 features that we depend upon so *all* of JSF 2.0 works under
>> Jave EE 5, but this could change if they come up with a feature that we
>> really need!

JA> I think this is a very interesting one. How will other Java EE6
JA> features like Bean Validation and Web Beans be used in JSF?

For those, you must have an EE6 container.

JA> Is it going to be some kind of SPI, making them pluggable or is JSF
JA> going to have compile time dependencies on those frameworks?

JA> After all, Web Beans is one of the things many people will probably
JA> "really need". :-)

Indeed, I think we really do need it in EE6!

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

edburns
Offline
Joined: 2004-02-11
Points: 0

There is indeed a bug hear that David Geary found, which I have just fixed. If your composite
component implementation section includes a naming container, and you have components
within that naming container that you want to expose as attached object targets to the using page,
then you're out of luck.

This is due to a bug in the implementation of the attached object target searching code.

I've fixed it in the latest Mojarra trunk.

Thanks for your continued interest!

Ed

Ed Burns

>>>>> On Tue, 25 Nov 2008 05:42:06 -0800 (PST), webtier@javadesktop.org said:

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

I am able to reproduce this problem and am working on it now.

It's a subtle bug and I'm very glad you found it!

Ed

--
| ed.burns@sun.com | office: 408 884 9519 OR x31640
| homepage: | http://ridingthecrest.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

ioss
Offline
Joined: 2007-01-26
Points: 0

Hi,

no idea yet.

I can only confirm, that it didn't work for me too. (Same Setup)
Later today I plan on trying that with a build from svn trunk. I will let you know if I had any success.

Imre

ddewaele
Offline
Joined: 2008-11-19
Points: 0

Latest version I tried was on the 2_0_0_B06 branch. Couldn't get it to work.