I'm writing a JSF2.0-component as a Java class and Renderer class and so on. I can't write parts of the output in the xhtml like
<h:outputText ... />
because the elements are generated dynamically.
So I get the message "The button/link/text component needs to have a Form in its ancestry. Please add .". Below you can see how I currently render a form. Is this correct too? Or should change something to make the warning dissappear?
private void encodeForm(Element elem) throws IOException {
//ResponsWriter writer
writer.startElement("form", form);
encodeChildren(elem);
writer.endElement("form");
}
Thanks for any help!
Is this correct too? Or should change something to make the warning dissappear?
Your best bet would be to just remove the code you've shown and ask the users of said component to place it inside a form.
At any length, what you're doing is writing markup for a form. This is something else than actually putting a form component in the tree.