如何向 JSF 数据表头添加特定属性



我正在使用JSF 2.2,并希望向数据表标题行添加一些特定属性。HTML 中的最终结果应如下所示。

<table>
<th my-attribute="myattributevalue"> Header Column </th>
....

这在 JSF 中可能吗?

使用<f:passThroughAttribute/>设置自定义属性。可以通过在<h:column/>上设置rowHeader="true"来渲染th

    <h:dataTable>
          <h:column rowHeader="true">
               <h:outputText value="Header Column"/>
               <f:passThroughAttribute name="my-attribute" value="myattributevalue"/>
          </h:column>
    </h:dataTable>

最新更新