且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSF ui:repeat vs h:dataTable

更新时间:2023-12-04 17:36:04

在任何情况下,唯一的选择就是使用h:dataTable?

  • 如果要使用 UIData 为基础的组件(UIRepeat中不存在其所有特殊属性).
  • 如果要通过JSF组件呈现HTML <table>.
  • 如果您希望能够自定义<table>渲染(例如PrimeFaces <p:dataTable>会进行排序,过滤,分组,折叠,延迟加载等).
  • 如果您不使用Facelets作为查看技术.
    • 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.
    • 或相反(唯一选择是ui:repeat)?

      • 如果您不希望以上任何内容,因此需要一个纯净的无标记迭代组件.
      • 如果您希望能够在迭代过程中跳过每个 n 个项目(使用step属性).
        • 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).