【问题标题】:After render jsf - empty tbody element渲染 jsf 后 - 空 tbody 元素
【发布时间】:2012-10-04 10:03:16
【问题描述】:

绘图表表示JSF 该表仅包括标题。渲染后仍然是一个空标签 TBODY

JSF:

   <h:dataTable>
         <h:column>
             <f:facet name="header">
               <h:outputText value="col1" />
             </f:facet>
          </h:column>
          <h:column>
             <f:facet name="header">
               <h:outputText value="col2" />
             </f:facet>
          </h:column>
    </h:dataTable>

html结果:

<table>
  <thead>
    <tr>
      <th>
        <span>col1</span>
      </th>
      <th>
        <span>col2</span>
      </th>
     </tr>
  </thead>
  <tbody> </tbody>
</table>

如何编写不会创建空 TBODY 元素的 JSF 代码

【问题讨论】:

    标签: java html css jsp jsf


    【解决方案1】:

    您的数据表没有任何问题。您定义的唯一内容是:

    • 我想要一张桌子;
    • 我希望表格有 2 列;
    • 我希望第一列的标题为“col1”;
    • 我希望第二列的标题为“col2”;

    这正是 JSF 为您呈现的内容。您没有将任何数据传递给数据表。您必须使用value 属性并传递一个列表。

    BalusC has an old article, but still usefull, about Using datatables.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      相关资源
      最近更新 更多