zoukankan      html  css  js  c++  java
  • JSF标签之f:facet 的使用方法


    f:facet标签用来为包含f:facet标签的父组件与被f:facet标签所包含的子组件之间申明一种特殊的关系。常与h:panelGrid,h:dataTable等标签连用,申明组件为标题或页脚。
    在自定义组件里,我们常可利用 f:facet 为组件添加特别的属性或处理,例如MyFaces提供的翻页组件就利用f:facet制作翻页工具条。
    f:facet用法例:f:facet常用用法
    <jsf组件>
         <f:facet name="facet名">...jsf组件</f:facet>
    </jsf组件>
    在自定义组件里使用f:facet时,可以使用UIComponent.getFacets().get("facet名")方法取得指定的facet组件:
    (UIComponent) getFacets().get("facet名");
    h:dataTable使用f:facet例:
    <h:dataTable value="#{myBean.bookList}" var= "book" border="1px">
         <h:column>
             <f:facet name="header">
                 <h:outputText value="Title"/>
             </f:facet>
             <h:outputText value="#{book.title}"/>
         </h:column>
         <h:column>
             <f:facet name="header">
                 <h:outputText value="Price"/>
             </f:facet>
             <h:outputText value="#{book.price}"/>
         </h:column>
    </h:dataTable>
    对应HTML代码:
    <table border="1px">
         <thead>
             <tr>
                 <th>Title</th>
                 <th>Name</th>
             </tr>
         </thead>

         <tbody>
             <tr>
                 <td>Hello</td>
                 <td>World</td>
             </tr>
         </tbody>
    </table>

    浏览器显示:
    Title Name Hello World
  • 相关阅读:
    C#调用Exe文件的方法及如何判断程序调用的exe已结束(转)
    C# Color (转)
    【666】语义分割减少过拟合
    【665】构建多损失函数
    libc timer
    分支管理
    MULLS:论文阅读
    微信支付宝整合支付开发中的常见问题
    IIS8中安装和使用URL重写工具(URL Rewrite)的方法
    通过Java 技术手段,检查你自己是不是被绿了...
  • 原文地址:https://www.cnblogs.com/iamconan/p/7383642.html
Copyright © 2011-2022 走看看