I have this JSF table with pagination.
Im not sure I understand correctly. You just want the rows numbered?
However, I don't think it's as easy as you might think it is. h:dataTable actually doesn't support this. And mixing h:dataTable and ui:repeat seems like the completely wrong way to do this (if I understand correctly).
You could:
Use t:dataTable (from Tomahawk: http://myfaces.apache.org/tomahawk/index.html). There you can use the rowIndexVar Attribute, like so:
<t:dataTable rowIndexVar="row" value="#{someBean.value}">
<h:column>
<h:outputText value="#{row + 1}"/>
</h:column>
</t:dataTable>
Alternativly, change your data model and provide the index inside there. Or use a wrapper class:
public class DataWrapper{
private int index;
private Object model;
// getter and setter
...
}
Then pass a list of DataWrapper to JSF, instead of your model directly. You need to set the index somewhere in your service layer first, of course.
I hope this helps. Let me know if you need further assistance.
Use UIData#getRowIndex().
<h:dataTable binding="#{table}" ...>
<h:column>
#{table.rowIndex + SessionsController.firstRow + 1}
</h:column>
...
</h:dataTable>