0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • It has to happen during view build time not view render time. Lookup taghandlers. Or, look for a different solution for the problem you had in mind. This all is strange. http://stackoverflow.com/q/6822000/ – BalusC Jan 06 '16 at 17:35
  • @BalusC, So I can't reuse a custom component to create a new one ? – Sergio Castillo Diaz Jan 06 '16 at 17:43

0 Answers0