I created a generic xhtml page in my java web app that gets all the users from a database table and shows them in a datatable, but I want to add buttons next to every row (view, edit, delete) that have unique ids and which invoke methods in the java bean passing their ids as arguments.
I'm new at this it seems incredibly simple, but nothing I tried works.
<h:form>
<h:dataTable value="#{functions.employees}" var="employee"
rowClasses="oddTableRow, evenTableRow"
headerClass="tableHeader"
styleClass="table">
<h:column>
<f:facet name="header">id</f:facet>
#{employee.id}
</h:column>
<h:column>
<f:facet name="header">First Name</f:facet>
#{employee.firstName}
</h:column>
<h:column>
<f:facet name="header">Last Name</f:facet>
#{employee.lastName}
</h:column>
<h:column>
<f:facet name="header">Adress</f:facet>
#{employee.adress}
</h:column>
<h:column>
<f:facet name="header">Phone</f:facet>
#{employee.phone}
</h:column>
<h:column>
<f:facet name="header">Email</f:facet>
#{employee.email}
</h:column>
<h:column>
<h:commandButton value="View" action="viewPage.xhtml">
<f: actionListener binding ="#{Functions.setId(id)}"
</h:commandButton>
</h:column>
<h:column>
<h:button value="Edit" outcome = "editPage.xhtml"/>
</h:column>
<h:column>
<h:button value="Delete" outcome = "#{Functions.delete(id)}"/>
</h:column>
</h:dataTable>
</h:form>