You can bind the datatable to backing bean component and then use the getRowData method to get the row data(which was clicked). Here is an example.
<h:dataTable value="#{b_empByNameList.names}" var="emp" id="dataTable"
binding="#{b_empByNameList.dataTable}">
<h:commandLink action="#{b_empByNameList.getEmployee}">
<h:outputText value="#{emp.employeeId}"/>
</h:commandLink>
In the Backing Bean
private HtmlDataTable dataTable;
// component binding..
public void setDataTable(HtmlDataTable dataTable) {
this.dataTable = dataTable;
}
public HtmlDataTable getDataTable() {
return dataTable;
}
// this method gets called when the command link is clicked
public String getEmployee() {
Employee empObj = (Employee)this.getDataTable().getRowData();
// do your row processing here...
}