JSF ui:repeat vs h:dataTable

微笑、不失礼 提交于 2019-12-09 00:54:02

问题


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)?


回答1:


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).


来源:https://stackoverflow.com/questions/28943595/jsf-uirepeat-vs-hdatatable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!