Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF ui:repeat vs h:dataTable

Before asking this question, I visited many other related ones and tried to gather the maximum of information. But, what I found till now let me understand that there is no real/major difference between ui:repeat and h:dataTable, and that whenever we can use h:dataTable we can also use ui:repeat (sometimes one of them is a little complex than the other, but at the end we got same results).

So, is there any use cases where the only choice is to use h:dataTable? or the opposite (only choice is ui:repeat)?

like image 303
Tarik Avatar asked Mar 16 '23 19:03

Tarik


1 Answers

is there any use cases where the only choice is to use h:dataTable?

  • If you want to use an UIData-based component (with all of its special attributes absent in UIRepeat).
  • If you want to render a HTML <table> by a JSF component.
  • If you want to be able to customize the <table> rendering (like PrimeFaces <p:dataTable> does with sorting, filtering, grouping, folding, lazyloading, etc, etc).
  • If you aren't using Facelets as view technology.

or the opposite (only choice is ui:repeat)?

  • If you don't want any of above and thus need a pure markup-less iteration component.
  • If you want to be able to skip every n items during iteration (using step attribute).
like image 73
BalusC Avatar answered Apr 09 '23 22:04

BalusC