Call JSF action method from custom component with parameters and table
I'm trying to make a composite component containing a table with a commandButton on each row, calling an actionmethod taking the row object as a parameter. It would look like this without being a custom component:
<h:dataTable value=#{bean.objects} var="obj">
&l开发者_StackOverflow中文版t;h:column>
<h:commandButton id="button" action="#{bean.doSomething(obj)}" value="Do something with obj" ajax=false"/>
</h:column>
</h:dataTable>
What kind of composite:interface parameters would enable this to work? I've tried with composite:actionSource
, composite:attribute with target="button"
etc, making the action parameter a f:propertyActionListener
etc, but nothing has worked so far. As an ugly solution, I send the controller as a parameter and call methods directly from it, but is there a more elegant way?
精彩评论