gpt4 book ai didi

java - 渲染 jsf 后 - 空 tbody 元素

转载 作者:太空宇宙 更新时间:2023-11-04 04:54:37 26 4
gpt4 key购买 nike

绘图表是指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 代码

最佳答案

你的dataTable没有问题。您定义的唯一内容是:

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

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

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

关于java - 渲染 jsf 后 - 空 tbody 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12724871/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com