h:commandButton action not working inside a h:datatable.

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-10T03:22:29Z Indexed on 2010/05/10 3:28 UTC
Read the original article Hit count: 312

Filed under:
|

I'm stuck with this piece of jsf code that I don't understand why it's working when used outside a datatable and doesn't inside a datatable...

<h:dataTable id="myTable" rendered="true" value="#{bean.selectedItemsList}" var="items">
   <h:column>
    <h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif">
     <f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>
    </h:commandButton>
   </h:column>
   <h:column>
    <h:outputText value="#{items}" />
   </h:column>
  </h:dataTable>

I read around the net to put value="#{items}" inside the action listener so the action can get the items in the row like this:

<f:actionListener value="#{items}" binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>

But it's doesn't work either.

Bu if I do the action outside the data table everything work fine.

<h:commandButton action="#{bean.removeItemFromList}" image="/resources/images/deleterow.gif">
    <f:actionListener binding="#{bean.actionListenerImpl}" type="com.mycorp.ActionListenerImpl"/>
   </h:commandButton>

Side note I also tried a4j:commandButton and didn't so I guess my problem is probably the actionlistener or how the bean handling it.

© Stack Overflow or respective owner

Related posts about jsf

Related posts about richfaces