Hi there,
I'm having a problem with a bound form component and its children not
getting rendered. I'm using JSF 1.1_01.
Managed Bean:
public class MyBean {
public HtmlForm getForm() {
FacesContext context = FacesContext.getCurrentInstance();
HtmlForm form = new HtmlForm();
HtmlCommandButton button = new HtmlCommandButton();
button.setValue("Button");
button.setId(context.getViewRoot().createUniqueId());
form.getChildren().add(button);
return form;
}
public void setForm(HtmlForm form) {
// Do nothing
}
}
JSP:
<h1>Form 1 (bound)</h1>
<h:form binding="#{MyBean.form}" id="form1">
</h:form>
<h1>Form 2 (bound, inside panelGroup)</h1>
<h:panelGroup>
<h:form binding="#{MyBean.form}" id="form2">
</h:form>
</h:panelGroup>
The button inside form2 gets rendered, while the button inside form1
doesn't.
I've tried to work this out but haven't got very far. My best guess is
that this is because the panelGroup recursively renders its children and
the form doesn't, and since the neither button has a JSP tag the form1's
button's encode methods don't get called by anything.
Do I have to work around this by putting all bound forms in a panelGroup?
Thanks,
-Guy Coleman.