You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Ganesh <ga...@j4fry.org> on 2010/10/12 15:19:32 UTC

nesting cc:actionListener

Hi,

If my test page calls a composite component in level 1:

	xmlns:level1="http://java.sun.com/jsf/composite/level1"

	<level1:button value="test1">
		<f:actionListener for="button1" binding="#{myBean.action1}" />
	</level1:button>

where level1 button passes the action listener on to level 2:

	xmlns:level2="http://java.sun.com/jsf/composite/level2"

	<!-- INTERFACE -->
	<composite:interface>
		<composite:attribute name="value"/>
		<composite:actionSource name="button1" />
	</composite:interface>

	<!-- IMPLEMENTATION -->
	<composite:implementation>
		<level2:button id="button1" value="#{cc.attrs.value}"/>
	</composite:implementation>

and level 2 finally consumes the action:

	<!-- INTERFACE -->
	<composite:interface>
		<composite:attribute name="value"/>
		<composite:actionSource name="button2" />
	</composite:interface>

	<!-- IMPLEMENTATION -->
	<composite:implementation>
		<h:commandButton id="button2" value="#{cc.attrs.value}" />
	</composite:implementation>

Shouldn't this call the ActionListener returned by getAction1()? In fact it doesn't, if you agree that it should I will open an issue.

Best regards,
Ganesh

Re: nesting cc:actionListener

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I finally created an issue:

https://issues.apache.org/jira/browse/MYFACES-2946

and attached a patch there. In theory, we can include it on myfaces 2.0.x,
because composite:attribute "targets" opens the posibility to do it, so I'll
commit the patch soon.

regards,

Leonardo Uribe

Re: nesting cc:actionListener

Posted by Ganesh <ga...@j4fry.org>.
ok, thank you, so I will not open a MyFaces issue on this but comment the spec issue instead.

Best regards,
Ganesh

Am 13.10.2010 11:15, schrieb Jakob Korherr:
> Hi Ganesh,
>
> Sorry, I was too fast in writing the answer. It works if you're using
> f:actionListener, but it does not work correctly, if you're using a
> parameter like action or actionListener (this is the related spec
> issue).
>
> Regards,
> Jakob
>
> 2010/10/13 Ganesh<ga...@j4fry.org>:
>> This is cool, thank you for sending the fixed example! How comes this works,
>> though
>> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>> is retargeted to 2.2? Do you have one more in your magic box for actions or
>> does the spec issue remain valid here? If I do this:
>>
>>         <!-- INTERFACE -->
>>         <composite:interface>
>>                 <composite:attribute name="value"/>
>>                 <composite:attribute name="action"
>> method-signature="java.lang.String action()" targets="button1"/>
>>         </composite:interface>
>>
>>         <!-- IMPLEMENTATION -->
>>         <composite:implementation>
>>                 <level2:button id="button1" value="#{cc.attrs.value}"/>
>>         </composite:implementation>
>>
>> then calling the page gives me:
>>
>> java.lang.ClassCastException: javax.faces.component.UINamingContainer cannot
>> be cast to javax.faces.component.ActionSource2
>>
>> though level2:button is an ActionSource:
>>
>>         <!-- INTERFACE -->
>>         <composite:interface>
>>                 <composite:attribute name="value"/>
>>                 <composite:attribute name="action"
>> method-signature="java.lang.String action()" targets="button2"/>
>>         </composite:interface>
>>
>>         <!-- IMPLEMENTATION -->
>>         <composite:implementation>
>>                 <h:commandButton id="button2" value="#{cc.attrs.value}"/>
>>         </composite:implementation>
>>
>> but probably not an ActionSource2 :-(
>>
>> Best regards,
>> Ganesh
>>
>> Am 12.10.2010 19:24, schrieb Leonardo Uribe:
>>>
>>> Hi
>>>
>>> I tried your example and work in this way:
>>>
>>> test page calls a composite component in level 1:
>>>
>>>         xmlns:level1="http://java.sun.com/jsf/composite/level1"
>>>
>>> <level1:button value="test1">
>>> <f:actionListener for="button1" binding="#{myBean.action1}" />
>>> </level1:button>
>>>
>>> level1 button passes the action listener on to level 2:
>>>
>>>         xmlns:level2="http://java.sun.com/jsf/composite/level2"
>>>
>>> <!-- INTERFACE -->
>>> <composite:interface>
>>> <composite:attribute name="value"/>
>>> <composite:actionSource name="button1" targets="button1" />  <!-- "targets"
>>> here is optional -->
>>> </composite:interface>
>>>
>>> <!-- IMPLEMENTATION -->
>>> <composite:implementation>
>>> <level2:button id="button1" value="#{cc.attrs.value}"/>
>>> </composite:implementation>
>>>
>>>    level 2 finally consumes the action:
>>>
>>> <!-- INTERFACE -->
>>> <composite:interface>
>>> <composite:attribute name="value"/>
>>> <composite:actionSource name="button1" targets="button2" />
>>> </composite:interface>
>>>
>>> <!-- IMPLEMENTATION -->
>>> <composite:implementation>
>>> <h:commandButton id="button2" value="#{cc.attrs.value}" />
>>> </composite:implementation>
>>>
>>> regards,
>>>
>>> Leonardo
>>>
>>> 2010/10/12 Leonardo Uribe<lu...@gmail.com>>
>>>
>>>     Hi
>>>
>>>     I remember this one. Fortunately, MyFaces has many, many tests for
>>> composite
>>>     components. It also has a test for this specific issue and it works
>>> well:
>>>
>>>     testCompositeActionSource.xhtml
>>>
>>>     <h:form id="testForm1">
>>>     <testComposite:compositeActionSource>
>>>     <f:actionListener for="button2"
>>> binding="#{helloWorldBean.actionListener}"/>
>>>     </testComposite:compositeActionSource>
>>>     </h:form>
>>>
>>>     compositeActionSource.xhtml
>>>
>>>     <composite:interface>
>>>     <composite:actionSource name="button2" targets="button3"/>
>>>     </composite:interface>
>>>     <composite:implementation>
>>>     <testComposite:simpleActionSource id="button3">
>>>     <f:actionListener for="button"
>>> binding="#{helloWorldBean.actionListener}"/>
>>>     </testComposite:simpleActionSource>
>>>     </composite:implementation>
>>>
>>>     simpleActionSource.xhtml
>>>
>>>     <composite:interface>
>>>     <composite:actionSource name="button"/>
>>>     <composite:actionSource name="button2" targets="button"/>
>>>     </composite:interface>
>>>     <composite:implementation>
>>>     <h:commandButton id="button" value="Press me!" />
>>>     </composite:implementation>
>>>
>>>     The button finally should have two actionListener. Look the attribute
>>> "targets".
>>>     Try set it on your example. It should work without problem.
>>>
>>>     regards,
>>>
>>>     Leonardo Uribe
>>>
>>>
>>>     2010/10/12 Jakob Korherr<jakob.korherr@gmail.com
>>> <ma...@gmail.com>>
>>>
>>>         But anyhow, please open an issue for this. Thanks!
>>>
>>>         Regards,
>>>         Jakob
>>>
>>>         2010/10/12 Jakob Korherr<jakob.korherr@gmail.com
>>> <ma...@gmail.com>>:
>>>          >  Hi Ganesh,
>>>          >
>>>          >  This is a known problem of the JSF 2.0 spec, see [1]. Sadly it
>>> was
>>>          >  (re-)targeted for 2.2.
>>>          >
>>>          >  The problem is that when the ation listener is retargeted (from
>>> the
>>>          >  composite component to the inner (implementation) component), it
>>>          >  cannot be retargeted to another composite component, because
>>> this one
>>>          >  does not implement ActionSource2. IMO we could try to implement
>>> a
>>>          >  working solution already in MyFaces 2.0.x, but I don't know if
>>> this
>>>          >  stuff is tested by the TCK..
>>>          >
>>>          >  Regards,
>>>          >  Jakob
>>>          >
>>>          >  [1]
>>> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>>>          >
>>>          >  2010/10/12 Ganesh<ga...@j4fry.org>>:
>>>          >>  Hi,
>>>          >>
>>>          >>  If my test page calls a composite component in level 1:
>>>          >>
>>>          >>          xmlns:level1="http://java.sun.com/jsf/composite/level1"
>>>          >>
>>>          >>  <level1:button value="test1">
>>>          >>  <f:actionListener for="button1" binding="#{myBean.action1}"
>>>          >>  />
>>>          >>  </level1:button>
>>>          >>
>>>          >>  where level1 button passes the action listener on to level 2:
>>>          >>
>>>          >>          xmlns:level2="http://java.sun.com/jsf/composite/level2"
>>>          >>
>>>          >>  <!-- INTERFACE -->
>>>          >>  <composite:interface>
>>>          >>  <composite:attribute name="value"/>
>>>          >>  <composite:actionSource name="button1" />
>>>          >>  </composite:interface>
>>>          >>
>>>          >>  <!-- IMPLEMENTATION -->
>>>          >>  <composite:implementation>
>>>          >>  <level2:button id="button1" value="#{cc.attrs.value}"/>
>>>          >>  </composite:implementation>
>>>          >>
>>>          >>  and level 2 finally consumes the action:
>>>          >>
>>>          >>  <!-- INTERFACE -->
>>>          >>  <composite:interface>
>>>          >>  <composite:attribute name="value"/>
>>>          >>  <composite:actionSource name="button2" />
>>>          >>  </composite:interface>
>>>          >>
>>>          >>  <!-- IMPLEMENTATION -->
>>>          >>  <composite:implementation>
>>>          >>  <h:commandButton id="button2" value="#{cc.attrs.value}" />
>>>          >>  </composite:implementation>
>>>          >>
>>>          >>  Shouldn't this call the ActionListener returned by
>>> getAction1()? In fact it
>>>          >>  doesn't, if you agree that it should I will open an issue.
>>>          >>
>>>          >>  Best regards,
>>>          >>  Ganesh
>>>          >>
>>>          >
>>>          >
>>>          >
>>>          >  --
>>>          >  Jakob Korherr
>>>          >
>>>          >  blog: http://www.jakobk.com
>>>          >  twitter: http://twitter.com/jakobkorherr
>>>          >  work: http://www.irian.at
>>>          >
>>>
>>>
>>>
>>>         --
>>>         Jakob Korherr
>>>
>>>         blog: http://www.jakobk.com
>>>         twitter: http://twitter.com/jakobkorherr
>>>         work: http://www.irian.at
>>>
>>>
>>>
>>
>> --
>> "There are two kinds of people in the world, those who believe there are two
>> kinds of people and those who don't."
>> — Robert Benchley
>>
>
>
>

-- 
"There are two kinds of people in the world, those who believe there are two kinds of people and those who don't."
— Robert Benchley

Re: nesting cc:actionListener

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Ganesh,

Sorry, I was too fast in writing the answer. It works if you're using
f:actionListener, but it does not work correctly, if you're using a
parameter like action or actionListener (this is the related spec
issue).

Regards,
Jakob

2010/10/13 Ganesh <ga...@j4fry.org>:
> This is cool, thank you for sending the fixed example! How comes this works,
> though
> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
> is retargeted to 2.2? Do you have one more in your magic box for actions or
> does the spec issue remain valid here? If I do this:
>
>        <!-- INTERFACE -->
>        <composite:interface>
>                <composite:attribute name="value"/>
>                <composite:attribute name="action"
> method-signature="java.lang.String action()" targets="button1"/>
>        </composite:interface>
>
>        <!-- IMPLEMENTATION -->
>        <composite:implementation>
>                <level2:button id="button1" value="#{cc.attrs.value}"/>
>        </composite:implementation>
>
> then calling the page gives me:
>
> java.lang.ClassCastException: javax.faces.component.UINamingContainer cannot
> be cast to javax.faces.component.ActionSource2
>
> though level2:button is an ActionSource:
>
>        <!-- INTERFACE -->
>        <composite:interface>
>                <composite:attribute name="value"/>
>                <composite:attribute name="action"
> method-signature="java.lang.String action()" targets="button2"/>
>        </composite:interface>
>
>        <!-- IMPLEMENTATION -->
>        <composite:implementation>
>                <h:commandButton id="button2" value="#{cc.attrs.value}"/>
>        </composite:implementation>
>
> but probably not an ActionSource2 :-(
>
> Best regards,
> Ganesh
>
> Am 12.10.2010 19:24, schrieb Leonardo Uribe:
>>
>> Hi
>>
>> I tried your example and work in this way:
>>
>> test page calls a composite component in level 1:
>>
>>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>>
>> <level1:button value="test1">
>> <f:actionListener for="button1" binding="#{myBean.action1}" />
>> </level1:button>
>>
>> level1 button passes the action listener on to level 2:
>>
>>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>>
>> <!-- INTERFACE -->
>> <composite:interface>
>> <composite:attribute name="value"/>
>> <composite:actionSource name="button1" targets="button1" /> <!-- "targets"
>> here is optional -->
>> </composite:interface>
>>
>> <!-- IMPLEMENTATION -->
>> <composite:implementation>
>> <level2:button id="button1" value="#{cc.attrs.value}"/>
>> </composite:implementation>
>>
>>   level 2 finally consumes the action:
>>
>> <!-- INTERFACE -->
>> <composite:interface>
>> <composite:attribute name="value"/>
>> <composite:actionSource name="button1" targets="button2" />
>> </composite:interface>
>>
>> <!-- IMPLEMENTATION -->
>> <composite:implementation>
>> <h:commandButton id="button2" value="#{cc.attrs.value}" />
>> </composite:implementation>
>>
>> regards,
>>
>> Leonardo
>>
>> 2010/10/12 Leonardo Uribe <lu4242@gmail.com <ma...@gmail.com>>
>>
>>    Hi
>>
>>    I remember this one. Fortunately, MyFaces has many, many tests for
>> composite
>>    components. It also has a test for this specific issue and it works
>> well:
>>
>>    testCompositeActionSource.xhtml
>>
>>    <h:form id="testForm1">
>>    <testComposite:compositeActionSource>
>>    <f:actionListener for="button2"
>> binding="#{helloWorldBean.actionListener}"/>
>>    </testComposite:compositeActionSource>
>>    </h:form>
>>
>>    compositeActionSource.xhtml
>>
>>    <composite:interface>
>>    <composite:actionSource name="button2" targets="button3"/>
>>    </composite:interface>
>>    <composite:implementation>
>>    <testComposite:simpleActionSource id="button3" >
>>    <f:actionListener for="button"
>> binding="#{helloWorldBean.actionListener}"/>
>>    </testComposite:simpleActionSource>
>>    </composite:implementation>
>>
>>    simpleActionSource.xhtml
>>
>>    <composite:interface>
>>    <composite:actionSource name="button"/>
>>    <composite:actionSource name="button2" targets="button"/>
>>    </composite:interface>
>>    <composite:implementation>
>>    <h:commandButton id="button" value="Press me!" />
>>    </composite:implementation>
>>
>>    The button finally should have two actionListener. Look the attribute
>> "targets".
>>    Try set it on your example. It should work without problem.
>>
>>    regards,
>>
>>    Leonardo Uribe
>>
>>
>>    2010/10/12 Jakob Korherr <jakob.korherr@gmail.com
>> <ma...@gmail.com>>
>>
>>        But anyhow, please open an issue for this. Thanks!
>>
>>        Regards,
>>        Jakob
>>
>>        2010/10/12 Jakob Korherr <jakob.korherr@gmail.com
>> <ma...@gmail.com>>:
>>         > Hi Ganesh,
>>         >
>>         > This is a known problem of the JSF 2.0 spec, see [1]. Sadly it
>> was
>>         > (re-)targeted for 2.2.
>>         >
>>         > The problem is that when the ation listener is retargeted (from
>> the
>>         > composite component to the inner (implementation) component), it
>>         > cannot be retargeted to another composite component, because
>> this one
>>         > does not implement ActionSource2. IMO we could try to implement
>> a
>>         > working solution already in MyFaces 2.0.x, but I don't know if
>> this
>>         > stuff is tested by the TCK..
>>         >
>>         > Regards,
>>         > Jakob
>>         >
>>         > [1]
>> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>>         >
>>         > 2010/10/12 Ganesh <ganesh@j4fry.org <ma...@j4fry.org>>:
>>         >> Hi,
>>         >>
>>         >> If my test page calls a composite component in level 1:
>>         >>
>>         >>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>>         >>
>>         >> <level1:button value="test1">
>>         >> <f:actionListener for="button1" binding="#{myBean.action1}"
>>         >> />
>>         >> </level1:button>
>>         >>
>>         >> where level1 button passes the action listener on to level 2:
>>         >>
>>         >>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>>         >>
>>         >> <!-- INTERFACE -->
>>         >> <composite:interface>
>>         >> <composite:attribute name="value"/>
>>         >> <composite:actionSource name="button1" />
>>         >> </composite:interface>
>>         >>
>>         >> <!-- IMPLEMENTATION -->
>>         >> <composite:implementation>
>>         >> <level2:button id="button1" value="#{cc.attrs.value}"/>
>>         >> </composite:implementation>
>>         >>
>>         >> and level 2 finally consumes the action:
>>         >>
>>         >> <!-- INTERFACE -->
>>         >> <composite:interface>
>>         >> <composite:attribute name="value"/>
>>         >> <composite:actionSource name="button2" />
>>         >> </composite:interface>
>>         >>
>>         >> <!-- IMPLEMENTATION -->
>>         >> <composite:implementation>
>>         >> <h:commandButton id="button2" value="#{cc.attrs.value}" />
>>         >> </composite:implementation>
>>         >>
>>         >> Shouldn't this call the ActionListener returned by
>> getAction1()? In fact it
>>         >> doesn't, if you agree that it should I will open an issue.
>>         >>
>>         >> Best regards,
>>         >> Ganesh
>>         >>
>>         >
>>         >
>>         >
>>         > --
>>         > Jakob Korherr
>>         >
>>         > blog: http://www.jakobk.com
>>         > twitter: http://twitter.com/jakobkorherr
>>         > work: http://www.irian.at
>>         >
>>
>>
>>
>>        --
>>        Jakob Korherr
>>
>>        blog: http://www.jakobk.com
>>        twitter: http://twitter.com/jakobkorherr
>>        work: http://www.irian.at
>>
>>
>>
>
> --
> "There are two kinds of people in the world, those who believe there are two
> kinds of people and those who don't."
> — Robert Benchley
>



-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Re: nesting cc:actionListener

Posted by Ganesh <ga...@j4fry.org>.
This is cool, thank you for sending the fixed example! How comes this works, though https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755 is retargeted to 2.2? Do you have one more in your magic box for actions or does the spec issue remain valid here? If I do this:

	<!-- INTERFACE -->
	<composite:interface>
		<composite:attribute name="value"/>
		<composite:attribute name="action" method-signature="java.lang.String action()" targets="button1"/>
	</composite:interface>

	<!-- IMPLEMENTATION -->
	<composite:implementation>
		<level2:button id="button1" value="#{cc.attrs.value}"/>
	</composite:implementation>

then calling the page gives me:

java.lang.ClassCastException: javax.faces.component.UINamingContainer cannot be cast to javax.faces.component.ActionSource2

though level2:button is an ActionSource:

	<!-- INTERFACE -->
	<composite:interface>
		<composite:attribute name="value"/>
		<composite:attribute name="action" method-signature="java.lang.String action()" targets="button2"/>
	</composite:interface>

	<!-- IMPLEMENTATION -->
	<composite:implementation>
		<h:commandButton id="button2" value="#{cc.attrs.value}"/>
	</composite:implementation>

but probably not an ActionSource2 :-(

Best regards,
Ganesh

Am 12.10.2010 19:24, schrieb Leonardo Uribe:
> Hi
>
> I tried your example and work in this way:
>
> test page calls a composite component in level 1:
>
>         xmlns:level1="http://java.sun.com/jsf/composite/level1"
>
> <level1:button value="test1">
> <f:actionListener for="button1" binding="#{myBean.action1}" />
> </level1:button>
>
> level1 button passes the action listener on to level 2:
>
>         xmlns:level2="http://java.sun.com/jsf/composite/level2"
>
> <!-- INTERFACE -->
> <composite:interface>
> <composite:attribute name="value"/>
> <composite:actionSource name="button1" targets="button1" /> <!-- "targets" here is optional -->
> </composite:interface>
>
> <!-- IMPLEMENTATION -->
> <composite:implementation>
> <level2:button id="button1" value="#{cc.attrs.value}"/>
> </composite:implementation>
>
>    level 2 finally consumes the action:
>
> <!-- INTERFACE -->
> <composite:interface>
> <composite:attribute name="value"/>
> <composite:actionSource name="button1" targets="button2" />
> </composite:interface>
>
> <!-- IMPLEMENTATION -->
> <composite:implementation>
> <h:commandButton id="button2" value="#{cc.attrs.value}" />
> </composite:implementation>
>
> regards,
>
> Leonardo
>
> 2010/10/12 Leonardo Uribe <lu4242@gmail.com <ma...@gmail.com>>
>
>     Hi
>
>     I remember this one. Fortunately, MyFaces has many, many tests for composite
>     components. It also has a test for this specific issue and it works well:
>
>     testCompositeActionSource.xhtml
>
>     <h:form id="testForm1">
>     <testComposite:compositeActionSource>
>     <f:actionListener for="button2" binding="#{helloWorldBean.actionListener}"/>
>     </testComposite:compositeActionSource>
>     </h:form>
>
>     compositeActionSource.xhtml
>
>     <composite:interface>
>     <composite:actionSource name="button2" targets="button3"/>
>     </composite:interface>
>     <composite:implementation>
>     <testComposite:simpleActionSource id="button3" >
>     <f:actionListener for="button" binding="#{helloWorldBean.actionListener}"/>
>     </testComposite:simpleActionSource>
>     </composite:implementation>
>
>     simpleActionSource.xhtml
>
>     <composite:interface>
>     <composite:actionSource name="button"/>
>     <composite:actionSource name="button2" targets="button"/>
>     </composite:interface>
>     <composite:implementation>
>     <h:commandButton id="button" value="Press me!" />
>     </composite:implementation>
>
>     The button finally should have two actionListener. Look the attribute "targets".
>     Try set it on your example. It should work without problem.
>
>     regards,
>
>     Leonardo Uribe
>
>
>     2010/10/12 Jakob Korherr <jakob.korherr@gmail.com <ma...@gmail.com>>
>
>         But anyhow, please open an issue for this. Thanks!
>
>         Regards,
>         Jakob
>
>         2010/10/12 Jakob Korherr <jakob.korherr@gmail.com <ma...@gmail.com>>:
>          > Hi Ganesh,
>          >
>          > This is a known problem of the JSF 2.0 spec, see [1]. Sadly it was
>          > (re-)targeted for 2.2.
>          >
>          > The problem is that when the ation listener is retargeted (from the
>          > composite component to the inner (implementation) component), it
>          > cannot be retargeted to another composite component, because this one
>          > does not implement ActionSource2. IMO we could try to implement a
>          > working solution already in MyFaces 2.0.x, but I don't know if this
>          > stuff is tested by the TCK..
>          >
>          > Regards,
>          > Jakob
>          >
>          > [1] https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>          >
>          > 2010/10/12 Ganesh <ganesh@j4fry.org <ma...@j4fry.org>>:
>          >> Hi,
>          >>
>          >> If my test page calls a composite component in level 1:
>          >>
>          >>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>          >>
>          >> <level1:button value="test1">
>          >> <f:actionListener for="button1" binding="#{myBean.action1}"
>          >> />
>          >> </level1:button>
>          >>
>          >> where level1 button passes the action listener on to level 2:
>          >>
>          >>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>          >>
>          >> <!-- INTERFACE -->
>          >> <composite:interface>
>          >> <composite:attribute name="value"/>
>          >> <composite:actionSource name="button1" />
>          >> </composite:interface>
>          >>
>          >> <!-- IMPLEMENTATION -->
>          >> <composite:implementation>
>          >> <level2:button id="button1" value="#{cc.attrs.value}"/>
>          >> </composite:implementation>
>          >>
>          >> and level 2 finally consumes the action:
>          >>
>          >> <!-- INTERFACE -->
>          >> <composite:interface>
>          >> <composite:attribute name="value"/>
>          >> <composite:actionSource name="button2" />
>          >> </composite:interface>
>          >>
>          >> <!-- IMPLEMENTATION -->
>          >> <composite:implementation>
>          >> <h:commandButton id="button2" value="#{cc.attrs.value}" />
>          >> </composite:implementation>
>          >>
>          >> Shouldn't this call the ActionListener returned by getAction1()? In fact it
>          >> doesn't, if you agree that it should I will open an issue.
>          >>
>          >> Best regards,
>          >> Ganesh
>          >>
>          >
>          >
>          >
>          > --
>          > Jakob Korherr
>          >
>          > blog: http://www.jakobk.com
>          > twitter: http://twitter.com/jakobkorherr
>          > work: http://www.irian.at
>          >
>
>
>
>         --
>         Jakob Korherr
>
>         blog: http://www.jakobk.com
>         twitter: http://twitter.com/jakobkorherr
>         work: http://www.irian.at
>
>
>

-- 
"There are two kinds of people in the world, those who believe there are two kinds of people and those who don't."
— Robert Benchley

Re: nesting cc:actionListener

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I tried your example and work in this way:

test page calls a composite component in level 1:

       xmlns:level1="http://java.sun.com/jsf/composite/level1"

       <level1:button value="test1">
               <f:actionListener for="button1" binding="#{myBean.action1}"
/>
       </level1:button>

level1 button passes the action listener on to level 2:

       xmlns:level2="http://java.sun.com/jsf/composite/level2"

       <!-- INTERFACE -->
       <composite:interface>
               <composite:attribute name="value"/>
               <composite:actionSource name="button1" targets="button1" />
<!-- "targets" here is optional -->
       </composite:interface>

       <!-- IMPLEMENTATION -->
       <composite:implementation>
               <level2:button id="button1" value="#{cc.attrs.value}"/>
       </composite:implementation>

  level 2 finally consumes the action:

       <!-- INTERFACE -->
       <composite:interface>
               <composite:attribute name="value"/>
               <composite:actionSource name="button1" targets="button2" />
       </composite:interface>

       <!-- IMPLEMENTATION -->
       <composite:implementation>
               <h:commandButton id="button2" value="#{cc.attrs.value}" />
       </composite:implementation>

regards,

Leonardo

2010/10/12 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> I remember this one. Fortunately, MyFaces has many, many tests for
> composite
> components. It also has a test for this specific issue and it works well:
>
> testCompositeActionSource.xhtml
>
> <h:form id="testForm1">
> <testComposite:compositeActionSource>
>     <f:actionListener for="button2"
> binding="#{helloWorldBean.actionListener}"/>
> </testComposite:compositeActionSource>
> </h:form>
>
> compositeActionSource.xhtml
>
> <composite:interface>
>     <composite:actionSource name="button2" targets="button3"/>
> </composite:interface>
> <composite:implementation>
> <testComposite:simpleActionSource id="button3" >
>     <f:actionListener for="button"
> binding="#{helloWorldBean.actionListener}"/>
> </testComposite:simpleActionSource>
> </composite:implementation>
>
> simpleActionSource.xhtml
>
> <composite:interface>
>     <composite:actionSource name="button"/>
>     <composite:actionSource name="button2" targets="button"/>
> </composite:interface>
> <composite:implementation>
>     <h:commandButton id="button" value="Press me!" />
> </composite:implementation>
>
> The button finally should have two actionListener. Look the attribute
> "targets".
> Try set it on your example. It should work without problem.
>
> regards,
>
> Leonardo Uribe
>
>
> 2010/10/12 Jakob Korherr <ja...@gmail.com>
>
>> But anyhow, please open an issue for this. Thanks!
>>
>> Regards,
>> Jakob
>>
>> 2010/10/12 Jakob Korherr <ja...@gmail.com>:
>> > Hi Ganesh,
>> >
>> > This is a known problem of the JSF 2.0 spec, see [1]. Sadly it was
>> > (re-)targeted for 2.2.
>> >
>> > The problem is that when the ation listener is retargeted (from the
>> > composite component to the inner (implementation) component), it
>> > cannot be retargeted to another composite component, because this one
>> > does not implement ActionSource2. IMO we could try to implement a
>> > working solution already in MyFaces 2.0.x, but I don't know if this
>> > stuff is tested by the TCK..
>> >
>> > Regards,
>> > Jakob
>> >
>> > [1]
>> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>> >
>> > 2010/10/12 Ganesh <ga...@j4fry.org>:
>> >> Hi,
>> >>
>> >> If my test page calls a composite component in level 1:
>> >>
>> >>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>> >>
>> >>        <level1:button value="test1">
>> >>                <f:actionListener for="button1"
>> binding="#{myBean.action1}"
>> >> />
>> >>        </level1:button>
>> >>
>> >> where level1 button passes the action listener on to level 2:
>> >>
>> >>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>> >>
>> >>        <!-- INTERFACE -->
>> >>        <composite:interface>
>> >>                <composite:attribute name="value"/>
>> >>                <composite:actionSource name="button1" />
>> >>        </composite:interface>
>> >>
>> >>        <!-- IMPLEMENTATION -->
>> >>        <composite:implementation>
>> >>                <level2:button id="button1" value="#{cc.attrs.value}"/>
>> >>        </composite:implementation>
>> >>
>> >> and level 2 finally consumes the action:
>> >>
>> >>        <!-- INTERFACE -->
>> >>        <composite:interface>
>> >>                <composite:attribute name="value"/>
>> >>                <composite:actionSource name="button2" />
>> >>        </composite:interface>
>> >>
>> >>        <!-- IMPLEMENTATION -->
>> >>        <composite:implementation>
>> >>                <h:commandButton id="button2" value="#{cc.attrs.value}"
>> />
>> >>        </composite:implementation>
>> >>
>> >> Shouldn't this call the ActionListener returned by getAction1()? In
>> fact it
>> >> doesn't, if you agree that it should I will open an issue.
>> >>
>> >> Best regards,
>> >> Ganesh
>> >>
>> >
>> >
>> >
>> > --
>> > Jakob Korherr
>> >
>> > blog: http://www.jakobk.com
>> > twitter: http://twitter.com/jakobkorherr
>> > work: http://www.irian.at
>> >
>>
>>
>>
>> --
>> Jakob Korherr
>>
>> blog: http://www.jakobk.com
>> twitter: http://twitter.com/jakobkorherr
>> work: http://www.irian.at
>>
>
>

Re: nesting cc:actionListener

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I remember this one. Fortunately, MyFaces has many, many tests for composite

components. It also has a test for this specific issue and it works well:

testCompositeActionSource.xhtml

<h:form id="testForm1">
<testComposite:compositeActionSource>
    <f:actionListener for="button2"
binding="#{helloWorldBean.actionListener}"/>
</testComposite:compositeActionSource>
</h:form>

compositeActionSource.xhtml

<composite:interface>
    <composite:actionSource name="button2" targets="button3"/>
</composite:interface>
<composite:implementation>
<testComposite:simpleActionSource id="button3" >
    <f:actionListener for="button"
binding="#{helloWorldBean.actionListener}"/>
</testComposite:simpleActionSource>
</composite:implementation>

simpleActionSource.xhtml

<composite:interface>
    <composite:actionSource name="button"/>
    <composite:actionSource name="button2" targets="button"/>
</composite:interface>
<composite:implementation>
    <h:commandButton id="button" value="Press me!" />
</composite:implementation>

The button finally should have two actionListener. Look the attribute
"targets".
Try set it on your example. It should work without problem.

regards,

Leonardo Uribe

2010/10/12 Jakob Korherr <ja...@gmail.com>

> But anyhow, please open an issue for this. Thanks!
>
> Regards,
> Jakob
>
> 2010/10/12 Jakob Korherr <ja...@gmail.com>:
> > Hi Ganesh,
> >
> > This is a known problem of the JSF 2.0 spec, see [1]. Sadly it was
> > (re-)targeted for 2.2.
> >
> > The problem is that when the ation listener is retargeted (from the
> > composite component to the inner (implementation) component), it
> > cannot be retargeted to another composite component, because this one
> > does not implement ActionSource2. IMO we could try to implement a
> > working solution already in MyFaces 2.0.x, but I don't know if this
> > stuff is tested by the TCK..
> >
> > Regards,
> > Jakob
> >
> > [1]
> https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
> >
> > 2010/10/12 Ganesh <ga...@j4fry.org>:
> >> Hi,
> >>
> >> If my test page calls a composite component in level 1:
> >>
> >>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
> >>
> >>        <level1:button value="test1">
> >>                <f:actionListener for="button1"
> binding="#{myBean.action1}"
> >> />
> >>        </level1:button>
> >>
> >> where level1 button passes the action listener on to level 2:
> >>
> >>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
> >>
> >>        <!-- INTERFACE -->
> >>        <composite:interface>
> >>                <composite:attribute name="value"/>
> >>                <composite:actionSource name="button1" />
> >>        </composite:interface>
> >>
> >>        <!-- IMPLEMENTATION -->
> >>        <composite:implementation>
> >>                <level2:button id="button1" value="#{cc.attrs.value}"/>
> >>        </composite:implementation>
> >>
> >> and level 2 finally consumes the action:
> >>
> >>        <!-- INTERFACE -->
> >>        <composite:interface>
> >>                <composite:attribute name="value"/>
> >>                <composite:actionSource name="button2" />
> >>        </composite:interface>
> >>
> >>        <!-- IMPLEMENTATION -->
> >>        <composite:implementation>
> >>                <h:commandButton id="button2" value="#{cc.attrs.value}"
> />
> >>        </composite:implementation>
> >>
> >> Shouldn't this call the ActionListener returned by getAction1()? In fact
> it
> >> doesn't, if you agree that it should I will open an issue.
> >>
> >> Best regards,
> >> Ganesh
> >>
> >
> >
> >
> > --
> > Jakob Korherr
> >
> > blog: http://www.jakobk.com
> > twitter: http://twitter.com/jakobkorherr
> > work: http://www.irian.at
> >
>
>
>
> --
> Jakob Korherr
>
> blog: http://www.jakobk.com
> twitter: http://twitter.com/jakobkorherr
> work: http://www.irian.at
>

Re: nesting cc:actionListener

Posted by Jakob Korherr <ja...@gmail.com>.
But anyhow, please open an issue for this. Thanks!

Regards,
Jakob

2010/10/12 Jakob Korherr <ja...@gmail.com>:
> Hi Ganesh,
>
> This is a known problem of the JSF 2.0 spec, see [1]. Sadly it was
> (re-)targeted for 2.2.
>
> The problem is that when the ation listener is retargeted (from the
> composite component to the inner (implementation) component), it
> cannot be retargeted to another composite component, because this one
> does not implement ActionSource2. IMO we could try to implement a
> working solution already in MyFaces 2.0.x, but I don't know if this
> stuff is tested by the TCK..
>
> Regards,
> Jakob
>
> [1] https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755
>
> 2010/10/12 Ganesh <ga...@j4fry.org>:
>> Hi,
>>
>> If my test page calls a composite component in level 1:
>>
>>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>>
>>        <level1:button value="test1">
>>                <f:actionListener for="button1" binding="#{myBean.action1}"
>> />
>>        </level1:button>
>>
>> where level1 button passes the action listener on to level 2:
>>
>>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>>
>>        <!-- INTERFACE -->
>>        <composite:interface>
>>                <composite:attribute name="value"/>
>>                <composite:actionSource name="button1" />
>>        </composite:interface>
>>
>>        <!-- IMPLEMENTATION -->
>>        <composite:implementation>
>>                <level2:button id="button1" value="#{cc.attrs.value}"/>
>>        </composite:implementation>
>>
>> and level 2 finally consumes the action:
>>
>>        <!-- INTERFACE -->
>>        <composite:interface>
>>                <composite:attribute name="value"/>
>>                <composite:actionSource name="button2" />
>>        </composite:interface>
>>
>>        <!-- IMPLEMENTATION -->
>>        <composite:implementation>
>>                <h:commandButton id="button2" value="#{cc.attrs.value}" />
>>        </composite:implementation>
>>
>> Shouldn't this call the ActionListener returned by getAction1()? In fact it
>> doesn't, if you agree that it should I will open an issue.
>>
>> Best regards,
>> Ganesh
>>
>
>
>
> --
> Jakob Korherr
>
> blog: http://www.jakobk.com
> twitter: http://twitter.com/jakobkorherr
> work: http://www.irian.at
>



-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Re: nesting cc:actionListener

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Ganesh,

This is a known problem of the JSF 2.0 spec, see [1]. Sadly it was
(re-)targeted for 2.2.

The problem is that when the ation listener is retargeted (from the
composite component to the inner (implementation) component), it
cannot be retargeted to another composite component, because this one
does not implement ActionSource2. IMO we could try to implement a
working solution already in MyFaces 2.0.x, but I don't know if this
stuff is tested by the TCK..

Regards,
Jakob

[1] https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=755

2010/10/12 Ganesh <ga...@j4fry.org>:
> Hi,
>
> If my test page calls a composite component in level 1:
>
>        xmlns:level1="http://java.sun.com/jsf/composite/level1"
>
>        <level1:button value="test1">
>                <f:actionListener for="button1" binding="#{myBean.action1}"
> />
>        </level1:button>
>
> where level1 button passes the action listener on to level 2:
>
>        xmlns:level2="http://java.sun.com/jsf/composite/level2"
>
>        <!-- INTERFACE -->
>        <composite:interface>
>                <composite:attribute name="value"/>
>                <composite:actionSource name="button1" />
>        </composite:interface>
>
>        <!-- IMPLEMENTATION -->
>        <composite:implementation>
>                <level2:button id="button1" value="#{cc.attrs.value}"/>
>        </composite:implementation>
>
> and level 2 finally consumes the action:
>
>        <!-- INTERFACE -->
>        <composite:interface>
>                <composite:attribute name="value"/>
>                <composite:actionSource name="button2" />
>        </composite:interface>
>
>        <!-- IMPLEMENTATION -->
>        <composite:implementation>
>                <h:commandButton id="button2" value="#{cc.attrs.value}" />
>        </composite:implementation>
>
> Shouldn't this call the ActionListener returned by getAction1()? In fact it
> doesn't, if you agree that it should I will open an issue.
>
> Best regards,
> Ganesh
>



-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at