Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extended @FacesComponent as composite interface componentType renders nothing

I'm trying to extend JSF's component class (let it be one of h:panelGroup) and render it via composite component:

Step 1:

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

Step 2:

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

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

And step 3:

<xyz:panel>Hello world!</xyz:panel>

shows nothing. What am I missing here?

like image 523
andbi Avatar asked Dec 30 '25 18:12

andbi


1 Answers

The backing component of the composite component must implement NamingContainer and the getFamily() must return javax.faces.NamingContainer. See also description of the componentType attribute in the <composite:interface> tag documentation.

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

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

}

You can also choose to extend UINamingContainer instead, so that you can omit the getFamily().

See also:

  • Composite component wiki page
like image 182
BalusC Avatar answered Jan 03 '26 22:01

BalusC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!