I've created a custom component which extends the UIComponentBase
abstract class, so when I use this component: <test:mycomponent />
It works as espected.
I'm creating another custom component and I want to use the previously created component in this one, so I tried:
@Override
public void encodeBegin(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("mycomponent", this);
writer.endElement("mycomponent");
}
I new this was a long shot, since startElement
just creates a tag with the given component name i.e mycomponent
, so I searched around and found:
UIComponentBase mycomponent = (UIComponentBase)context.getApplication().createComponent("mycomponent");
If this is correct, how does one add the component ? I'm using JSF 2.2 A link to where I can find more on this would be greatly apreciated also.