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 <lu4...@gmail.com <mailto:lu4...@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.korh...@gmail.com <mailto:jakob.korh...@gmail.com>> But anyhow, please open an issue for this. Thanks! Regards, Jakob 2010/10/12 Jakob Korherr <jakob.korh...@gmail.com <mailto:jakob.korh...@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 <gan...@j4fry.org <mailto:gan...@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