JSF 2 dataTable row index without dataModel

Just bind the table to the view itself instead of to a bean.

<h:dataTable binding="#{table}" ...>

Then you can use #{table.rowIndex} where necessary. E.g.

<h:column>#{table.rowIndex + 1}</h:column>

Note that the code is as-is and that the EL variable name table is fully to your choice.

See also:

Leave a Comment