I have been searching a lot for a way to make a composite component similar to: <h:selectOneRadio />
but I did not succeed.
I want something like:
<myowntags:selectOneRadio>
<f:selectItem itemValue="value0" itemLabel="This is the value 0" />
<f:selectItem itemValue="value1" itemLabel="This is the value 1" />
<f:selectItem itemValue="value2" itemLabel="This is the value 2" />
</myowntags:selectOneRadio>
and:
<myowntags:selectOneRadio>
<f:selectItems value="#{controller.items}" />
</myowntags:selectOneRadio>
As you can see, I want this composite component to have a child: <f:selectItem /> and render it the way I want.
Thanks in advance.
You could check and iterate over them by
#{cc.children}. The#{cc}refers to the current compositeUIComponentinstance which in turn has agetChildren()method. You could do kind of aninstanceofcheck by checking the child’s FQN (or simple name if that’s sufficient) in the<cc:implementation>:Your next problem is however collecting the submitted values. For that you’d need to implement the
decode()method in the backingUIComponentwhich you reference by<cc:interface componentType>. Or, better, create a customUIComponentwith aRendererinstead. Taking over theRenderer‘s job in the view is clumsy.