Hi

I committed an implementation of this tag on myfaces. I have one question: why does not exists a class called javax.faces.view.ClientBehaviorAttachedObjectTarget? I had to add some code on vld.retargetAttachedObjects() to make this tag work when nested composite components are used. Really BehaviorHolderAttachedObjectTarget has a method called isDefaultEvent() but in my opinion it looks better to have a ClientBehaviorAttachedObjectTarget interface with two methods: isDefaultEvent() and getEvent().

regards,

Leonardo Uribe

2010/5/10 Roger Kitain <roger.kitain@oracle.com>
Filed as: https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=791


-roger


On 5/3/10 2:31 PM, David Geary wrote:
There is a <composite:clientBehavior> tag in the 2.0 version of JSF that comes with GlassFish, and it appears to work as advertised by Alexandr and Andy below.

But, as Alexandr points out, it’s not documented in the PDL docs, nor could I find any mention of it in the spec (or Ed’s book, either).

This is a vital tag that lets page authors attach ajax functionality to components within composite components. I see no reason why it should not be documented.

Does anyone know why this tag was not documented in the first place, or what the plans are for its future? Anyone know if it works with MyFaces 2.0?

If there’s not a compelling reason for blacklisting it from the docs, can we document it?

Thanks,


david



2009/5/26 Alexandr Smirnov <asmirnov@exadel.com>
Sure, the composite client event tags are not included in the PDL doc.
There is one            <composite:clientBehavior> tag with attributes: 'name' -
the virtual event name that composite component has.
'default' "true/false" defines the default event that is enclosed
<f:ajax> tag serves if 'event' attribute was omited.
'event' - the real event name for target component.
'targets' - space-delimited list of component id's for which composite
component behavior or <f:ajax> tag will be redirected.

The model with 'for' attribute was the first implementation but it was
replaced wit 'virtual' event model.

Andy Schwartz wrote:
> David -
>
> David Geary wrote On 5/24/2009 5:55 PM ET:
>> For JSF 2, we added a "for" attribute to f:actionListener,
>> f:converter, etc., but we don't have a "for" attribute for <f:ajax>.
>> AFAICT, that means that although you can attach listeners, validators,
>> converters, etc. to a component contained in a composite component,
>> you cannot attach Ajax functionality.
>>
>> Why is that? Is it an oversight, or is there some compelling technical
>> reason to disallow adding Ajax behavior to components contained in
>> composites?
>
> We definitely intended to support this, though instead of exposing a
> "for" attribute on <f:ajax>, we wanted to leverage the fact that
> behaviors already have a targeting mechanism in the "event" name.  The
> idea was that a composite component would, like any other
> ClientBehaviorHolder, expose a set of logical event names that behaviors
> can be attached to.  So, for example, assuming a composite component
> included "OK" and "Cancel" buttons and wanted to allow the user to
> attach action behaviors to these, the composite component might surface
> "okAction" and "cancelAction" event names, allowing the page author to do:
>
>  <foo:someComposite>
>    <f:ajax event="okAction"/>
>    <f:ajax event="cancelAction"/>
>  </foo:someComposite>
>
> I know that Alexander did the implementation work to get this up and
> running.  However, I do not see any pdldoc for the composite tag that
> the composite component author uses to specify the supported client
> behavior event names (composite:clientBehavior I believe).
>
> Alex, Roger -
>
> Did this make it into 2.0?
>
> Andy
>
>>
>> Thanks,
>>
>>
>> david