JSF 2 composite:actionSource exposing commandButtons in ui:repeat

拥有回忆 提交于 2019-12-11 03:36:11

问题


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}"&gt
     <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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!