<br><br><div class="gmail_quote">2010/5/3 David Geary <span dir="ltr">&lt;<a href="mailto:clarity.training@gmail.com">clarity.training@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">2010/5/3 Leonardo Uribe <span dir="ltr">&lt;<a href="mailto:lu4242@gmail.com" target="_blank">lu4242@gmail.com</a>&gt;</span><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi<div class="im"><br><br>In myfaces we don&#39;t have &lt;composite:clientBehavior&gt; tag. The reason is that we don&#39;t know which attributes this tag has, how it looks like or where there is some example.</div></blockquote>
<div><br></div>
<div>I am working on an article for ibm devworks where I give an example of &lt;composite:clientBehavior&gt; -- I can send you the article if you want, let me know. </div></div></blockquote><div><br>Yes, I would like to have this article, it will help a lot. If you have time, please send it to my mail. Thanks for your help.<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div>Anyway, here’s the core of my example. First, an icon composite component:</div>

<div><br></div><div><p style="margin: 0px; color: rgb(0, 145, 147);">&lt;!<span style="color: rgb(78, 145, 146);">DOCTYPE</span><span style="color: rgb(0, 0, 0);"> </span>html<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(146, 146, 146);">PUBLIC</span><span style="color: rgb(0, 0, 0);"> </span>&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</p>

<p style="margin: 0px; color: rgb(78, 144, 114);"><span style="color: rgb(0, 0, 0);">        </span>&quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&quot;<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; min-height: 15px;"><br></p><p style="margin: 0px; color: rgb(57, 51, 255);">
<span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">html</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">xmlns</span><span style="color: rgb(0, 0, 0);">=</span>&quot;<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>&quot;</p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(147, 33, 146);">xmlns:h</span><span style="color: rgb(0, 0, 0);">=</span>&quot;<a href="http://java.sun.com/jsf/html" target="_blank">http://java.sun.com/jsf/html</a>&quot;</p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(147, 33, 146);">xmlns:f</span><span style="color: rgb(0, 0, 0);">=</span>&quot;<a href="http://java.sun.com/jsf/core" target="_blank">http://java.sun.com/jsf/core</a>&quot;</p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(147, 33, 146);">xmlns:composite</span><span style="color: rgb(0, 0, 0);">=</span>&quot;<a href="http://java.sun.com/jsf/composite" target="_blank">http://java.sun.com/jsf/composite</a>&quot;<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; min-height: 15px;">    </p><p style="margin: 0px; color: rgb(78, 145, 146);">
<span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 145, 147);">&lt;</span>composite:interface<span style="color: rgb(0, 145, 147);">&gt;</span></p><p style="margin: 0px; color: rgb(78, 145, 146);">
<span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 145, 147);">&lt;</span>composite:attribute<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(57, 51, 255);">&quot;image&quot;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">required</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(57, 51, 255);">&quot;true&quot;</span><span style="color: rgb(0, 145, 147);">/&gt;</span></p>

<p style="margin: 0px; min-height: 15px;"><br></p><p style="margin: 0px; color: rgb(57, 51, 255);">
<span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">composite:actionSource</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">name</span><span style="color: rgb(0, 0, 0);">=</span>&quot;link&quot; <span style="color: rgb(147, 33, 146);">targets</span><span style="color: rgb(0, 0, 0);">=</span>&quot;#{clientId}:iconForm:link&quot;<span style="color: rgb(0, 145, 147);">/&gt;</span></p>

<p style="margin: 0px; min-height: 15px;">                                 </p><p style="margin: 0px; color: rgb(57, 51, 255);">
<span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">composite:clientBehavior</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">name</span><span style="color: rgb(0, 0, 0);">=</span>&quot;click&quot; <span style="color: rgb(147, 33, 146);">targets</span><span style="color: rgb(0, 0, 0);">=</span>&quot;#{clientId}:iconForm:link&quot;</p>

<p style="margin: 0px; color: rgb(57, 51, 255);">                           <span style="color: rgb(0, 0, 0);">  </span>  <span style="color: rgb(147, 33, 146);">event</span><span style="color: rgb(0, 0, 0);">=</span>&quot;action&quot;<span style="color: rgb(0, 145, 147);">/&gt;</span><span style="color: rgb(0, 0, 0);">                            </span></p>

<p style="margin: 0px; color: rgb(78, 145, 146);"><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 145, 147);">&lt;/</span>composite:interface<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; min-height: 15px;"><br></p><p style="margin: 0px; color: rgb(78, 145, 146);">
<span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 145, 147);">&lt;</span>composite:implementation<span style="color: rgb(0, 145, 147);">&gt;</span></p><p style="margin: 0px; color: rgb(57, 51, 255);">

<span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">div</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">id</span><span style="color: rgb(0, 0, 0);">=</span>&quot;#{cc.clientId}&quot;<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; min-height: 15px;">      </p><p style="margin: 0px;">
<span style="white-space: pre;">        </span>  <span style="white-space: pre;">        </span>    <span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">h:form</span> <span style="color: rgb(147, 33, 146);">id</span>=<span style="color: rgb(57, 51, 255);">&quot;iconForm&quot;</span><span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px;"><span style="white-space: pre;">                        </span>      <span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">h:commandLink</span> <span style="color: rgb(147, 33, 146);">id</span>=<span style="color: rgb(57, 51, 255);">&quot;link&quot;</span> <span style="color: rgb(147, 33, 146);">immediate</span>=<span style="color: rgb(57, 51, 255);">&quot;true&quot;</span><span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);"><span style="white-space: pre;">                        </span>        </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">h:graphicImage</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">value</span><span style="color: rgb(0, 0, 0);">=</span>&quot;#{cc.attrs.image}&quot;<span style="color: rgb(0, 145, 147);">/&gt;</span></p>

<p style="margin: 0px; color: rgb(78, 145, 146);"><span style="color: rgb(0, 0, 0);"><span style="white-space: pre;">                        </span>      </span><span style="color: rgb(0, 145, 147);">&lt;/</span>h:commandLink<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px;"><span style="white-space: pre;">                </span>      <span style="color: rgb(0, 145, 147);">&lt;/</span><span style="color: rgb(78, 145, 146);">h:form</span><span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; min-height: 15px;"><span style="white-space: pre;">        </span>    </p>
<p style="margin: 0px;"><span style="white-space: pre;">        </span>    <span style="color: rgb(0, 145, 147);">&lt;/</span><span style="color: rgb(78, 145, 146);">div</span><span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; color: rgb(78, 145, 146);"><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 145, 147);">&lt;/</span>composite:implementation<span style="color: rgb(0, 145, 147);">&gt;</span><span style="color: rgb(0, 0, 0);">    </span></p>

<p style="margin: 0px; color: rgb(78, 145, 146);"><span style="color: rgb(0, 145, 147);">&lt;/</span>html<span style="color: rgb(0, 145, 147);">&gt;</span></p>
<p style="margin: 0px; color: rgb(78, 145, 146);"><font color="#000000" face="arial"><span style="font-size: small;"><font color="#009193" face="Monaco" size="3"><span style="font-size: 11px;"><br>
</span></font></span></font></p></div><div>The &lt;composite:clientBehavior&gt; tag specifies the name of the event (click), the target(s) for the event (#{clientId}:iconForm:link), and the component event (action). </div>

<div><br></div><div>The preceding markup is in resources/util/icon.xhtml, so you use an icon like this:</div><div><br></div><div><p style="margin: 0px; color: rgb(57, 51, 255);">
<span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">util:icon</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">id</span><span style="color: rgb(0, 0, 0);">=</span>&quot;minus&quot;<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">image</span><span style="color: rgb(0, 0, 0);">=</span>&quot;#{resource[&#39;images:minus.gif&#39;]}&quot;<span style="color: rgb(0, 145, 147);">&gt;</span></p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);">          </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">f:ajax</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">event</span><span style="color: rgb(0, 0, 0);">=</span>&quot;click&quot;<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">render</span><span style="color: rgb(0, 0, 0);">=</span>&quot;:readout :fontPreview&quot;<span style="color: rgb(0, 145, 147);">/&gt;</span></p>

<p style="margin: 0px; color: rgb(57, 51, 255);"><span style="color: rgb(0, 0, 0);">          </span><span style="color: rgb(0, 145, 147);">&lt;</span><span style="color: rgb(78, 145, 146);">f:actionListener</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">for</span><span style="color: rgb(0, 0, 0);">=</span>&quot;link&quot;<span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(147, 33, 146);">type</span><span style="color: rgb(0, 0, 0);">=</span>&quot;com.clarity.DiskIconListener&quot;<span style="color: rgb(0, 145, 147);">/&gt;</span></p>

<p style="margin: 0px; color: rgb(78, 145, 146);"><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 145, 147);">&lt;/</span>util:icon<span style="color: rgb(0, 145, 147);">&gt;</span></p>
<div><font color="#009193" face="Monaco" size="3"><span style="font-size: 11px;"><br></span></font></div></div><div>For the click event in the icon, JSF makes an Ajax call to the server, and when the call returns, it renders readout and fontPreview components. The click event is associated with the action event of the target (the link). So, when an action event occurs in the link, JSF send an Ajax call to the server.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> In theory it works like &lt;composite:actionSource&gt;, &lt;composite:valueHolder&gt;, &lt;composite:editableValueHolder&gt;.</blockquote>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I pointed this issue multiple times (really a lot of times but it seems nobody took that seriously). Just take a look at: </blockquote>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><a href="http://markmail.org/message/dxlpoa3qgul7uuns?q=composite:clientBehavior" target="_blank">http://markmail.org/message/dxlpoa3qgul7uuns?q=composite:clientBehavior</a><br><br>As soon as any documentation is available on mojarra javadoc I&#39;ll do the necessary stuff on myfaces.<br>

</blockquote><div><br></div></div><div>This really needs to be addressed asap, so the feature does not become Mojarra-dependent, which greatly limits its usefulness. Besides the javadoc, it needs to be mentioned in the spec.</div>

<div><br></div><div>I think whoever documented the composite library should come forward and update the PDL docs and spec. And if Ed won’t do it, I might help out. :)</div><div><br></div><font color="#888888"><div><br></div>
<div>david</div></font><div><div></div><div class="h5"><div>
<br></div><div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>regards,<br><br>Leonardo Uribe<br><br><div class="gmail_quote">2010/5/3 David Geary <span dir="ltr">&lt;<a href="mailto:clarity.training@gmail.com" target="_blank">clarity.training@gmail.com</a>&gt;</span><div><div></div>

<div><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>Thanks, Roger!</div><div><br></div><div><br></div><div>david</div><div><br></div>2010/5/3 Roger Kitain <span dir="ltr">&lt;<a href="mailto:roger.kitain@oracle.com" target="_blank">roger.kitain@oracle.com</a>&gt;</span><div>


<div></div><div><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


  

<div bgcolor="#ffffff" text="#000000">
I think this was an oversight since this was one of the last remaining
spec areas that went in.<br>
I will file a spec issue on this.<br>
Thanks for catching it.<br>
<br>
-roger<div><div></div><div><br>
<br>
On 5/3/10 2:31 PM, David Geary wrote:
<blockquote type="cite">
  
There is a &lt;composite:clientBehavior&gt; tag in the 2.0 version of
JSF that comes with GlassFish, and it appears to work as advertised by
Alexandr and Andy below.
  <div><br>
  </div>
  <div>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).</div>
  <div><br>
  </div>
  <div>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.</div>
  <div><br>
  </div>
  <div>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?</div>
  <div><br>
  </div>
  <div>If there’s not a compelling reason for blacklisting it from the
docs, can we document it?</div>
  <div><br>
  </div>
  <div>Thanks,</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>david<br>
  <div><br>
  </div>
  <div><br>
  <br>
  <div>2009/5/26 Alexandr Smirnov <span>&lt;<a href="mailto:asmirnov@exadel.com" target="_blank">asmirnov@exadel.com</a>&gt;</span><br>
  <blockquote>Sure, the composite client event tags are not included in
the PDL doc.<br>
There is one            &lt;composite:clientBehavior&gt; tag with
attributes: &#39;name&#39; -<br>
the virtual event name that composite component has.<br>
&#39;default&#39; &quot;true/false&quot; defines the default event that is enclosed<br>
&lt;f:ajax&gt; tag serves if &#39;event&#39; attribute was omited.<br>
&#39;event&#39; - the real event name for target component.<br>
&#39;targets&#39; - space-delimited list of component id&#39;s for which composite<br>
component behavior or &lt;f:ajax&gt; tag will be redirected.<br>
    <br>
The model with &#39;for&#39; attribute was the first implementation but it was<br>
replaced wit &#39;virtual&#39; event model.<br>
    <div>
    <div><br>
Andy Schwartz wrote:<br>
&gt; David -<br>
&gt;<br>
&gt; David Geary wrote On 5/24/2009 5:55 PM ET:<br>
&gt;&gt; For JSF 2, we added a &quot;for&quot; attribute to f:actionListener,<br>
&gt;&gt; f:converter, etc., but we don&#39;t have a &quot;for&quot; attribute for
&lt;f:ajax&gt;.<br>
&gt;&gt; AFAICT, that means that although you can attach listeners,
validators,<br>
&gt;&gt; converters, etc. to a component contained in a composite
component,<br>
&gt;&gt; you cannot attach Ajax functionality.<br>
&gt;&gt;<br>
&gt;&gt; Why is that? Is it an oversight, or is there some compelling
technical<br>
&gt;&gt; reason to disallow adding Ajax behavior to components
contained in<br>
&gt;&gt; composites?<br>
&gt;<br>
&gt; We definitely intended to support this, though instead of exposing
a<br>
&gt; &quot;for&quot; attribute on &lt;f:ajax&gt;, we wanted to leverage the fact
that<br>
&gt; behaviors already have a targeting mechanism in the &quot;event&quot; name.
 The<br>
&gt; idea was that a composite component would, like any other<br>
&gt; ClientBehaviorHolder, expose a set of logical event names that
behaviors<br>
&gt; can be attached to.  So, for example, assuming a composite
component<br>
&gt; included &quot;OK&quot; and &quot;Cancel&quot; buttons and wanted to allow the user to<br>
&gt; attach action behaviors to these, the composite component might
surface<br>
&gt; &quot;okAction&quot; and &quot;cancelAction&quot; event names, allowing the page
author to do:<br>
&gt;<br>
&gt;  &lt;foo:someComposite&gt;<br>
&gt;    &lt;f:ajax event=&quot;okAction&quot;/&gt;<br>
&gt;    &lt;f:ajax event=&quot;cancelAction&quot;/&gt;<br>
&gt;  &lt;/foo:someComposite&gt;<br>
&gt;<br>
&gt; I know that Alexander did the implementation work to get this up
and<br>
&gt; running.  However, I do not see any pdldoc for the composite tag
that<br>
&gt; the composite component author uses to specify the supported client<br>
&gt; behavior event names (composite:clientBehavior I believe).<br>
&gt;<br>
&gt; Alex, Roger -<br>
&gt;<br>
&gt; Did this make it into 2.0?<br>
&gt;<br>
&gt; Andy<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; david<br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  </div>
  </div>
</blockquote>
<br>
<br>
</div></div><pre cols="72">-- 
<a href="mailto:roger.kitain@oracle.com" target="_blank">roger.kitain@oracle.com</a>
<a href="https://twitter.com/rogerk09" target="_blank">https://twitter.com/rogerk09</a>
<a href="http://www.java.net/blogs/rogerk" target="_blank">http://www.java.net/blogs/rogerk</a>  

</pre>
</div>

</blockquote></div><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div></div></div><br>
</blockquote></div><br>