I'm having trouble making a dataTable where each row has a inputText and a commandLink. When the link is clicked, only it's row's inputText's data is submitted.
Something like this?
<h:dataTable value="#{bean.items}" var="item">
<h:column>
<h:inputText value="#{bean.value}"/>
</h:column>
<h:column>
<h:commandLink action="#{bean.save}" value="save">
<f:setPropertyActionListener target="#{bean.item}" value="#{item}" />
</h:commandLink>
</h:column>
</h:dataTable>
Bean:
@RequestScoped
public class Bean {
private Item item;
private String value;
Right now, as it is, it's using the last row's inputText
to fill the value
. I wrapped another h:form
, but it broke other things and I've learned that nested h:form
is not the right way to do it hehe
What's the correct way to do this?
Thanks.