Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 作为复合接口componentType的扩展@FacesComponent不会呈现任何内容_Jsf_Jsf 2_Composite Component - Fatal编程技术网

Jsf 作为复合接口componentType的扩展@FacesComponent不会呈现任何内容

Jsf 作为复合接口componentType的扩展@FacesComponent不会呈现任何内容,jsf,jsf-2,composite-component,Jsf,Jsf 2,Composite Component,我试图扩展JSF的组件类(让它成为h:panelGroup中的一个),并通过复合组件呈现它: 步骤1: @FacesComponent(value="customPanel") public class CustomPanel extends HtmlPanelGroup { // or UIPanel } 步骤2: <!-- INTERFACE --> <composite:interface componentType="customPanel"/> <!-

我试图扩展JSF的组件类(让它成为
h:panelGroup
中的一个),并通过复合组件呈现它:

步骤1:

@FacesComponent(value="customPanel")
public class CustomPanel extends HtmlPanelGroup { // or UIPanel
}
步骤2:

<!-- INTERFACE -->
<composite:interface componentType="customPanel"/>

<!-- IMPLEMENTATION -->
<composite:implementation>
  <h:outputText value="Some text:"/>
  <composite:insertChildren/>
</composite:implementation>

步骤3:

<xyz:panel>Hello world!</xyz:panel>
你好,世界!

什么也看不出来。我错过了什么

复合组件的支持组件必须实现,
getFamily()
必须返回
javax.faces.NamingContainer
。另请参见中的
componentType
属性的说明

您也可以选择扩展,这样就可以省略
getFamily()

另见:
@FacesComponent(value="customPanel")
public class CustomPanel extends HtmlPanelGroup implements NamingContainer {

    @Override
    public String getFamily() {
        return UINamingContainer.COMPONENT_FAMILY;
    }

}