问题
In my composite component, I have a ui:repeat that has, among other static things, a command button, like this:
<ui:repeat var="article" value="#{cc.attrs.articleList}"> <strong>Aricle: #{article}</strong> <h:commandButton id="addToFavs" value="Subscribe" binding="..." type="..." > <f:setPropertyActionListener value="#{article}" target="..." /> </h:commandButton > </ui:repeat>
Now, I'd like to expose this event in the composite interface, so that in my page, I may attach event listeners and tie in f:ajax.
Had it been outside of ui:repeat (i.e., there existed only one such button), that would have been quite easy, like this:
<composite:interface> <composite:actionSource name="addToFavs" targets="#{cc.clientId}:addToFavs" /> <composite:clientBehavior name="ajax" default="true" event="action" targets="#{cc.clientId}:addToFavs"/> </composite:interface>
But that fails in this case, because there's no one component by that ID (addToFavs), but rather a bunch of them. Do you know how should I expose these buttons in the interface?
Regards,
Pradyumna
回答1:
Updating this post with my best guess, just in case someone wants to know if I could achieve it:
No I couldn't do it. Looks like we can't do it. We can only expose components whose IDs relative to the composite component are known to the component author apriori.
来源:https://stackoverflow.com/questions/3075602/jsf-2-compositeactionsource-exposing-commandbuttons-in-uirepeat