Jsf 作为复合接口componentType的扩展@FacesComponent不会呈现任何内容
我试图扩展JSF的组件类(让它成为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"/> <!-
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;
}
}