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 <[email protected]>

> But anyhow, please open an issue for this. Thanks!
>
> Regards,
> Jakob
>
> 2010/10/12 Jakob Korherr <[email protected]>:
> > 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 <[email protected]>:
> >> 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
>

Reply via email to