You can use the attribute p:dataTable rowIndexVar.
The name of the iterator to access the index of each row
Whose name of the iterator can be used in EL to get the string identifier
For example: if rowIndexVar="myId", then you can access each row index using this iterator name in EL using #{myID}.
Example:
<p:dataTable rowIndexVar="rowId" value="..." var="...">
<p:column>
<h:commandLink action="#{...}">
<f:param name="id" value="#{rowId}" />
</h:commandLink>
</p:column>
</p:dataTable>
source
share