开发者

Call JSF action method from custom component with parameters and table

开发者 https://www.devze.com 2023-04-10 00:28 出处:网络
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 cus

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号