I am trying to bind h:panelGroup to UIComponent (HtmlPanelGroup) code like a:
p.s I am using faces-config.xml
import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import javax.faces.component.html.HtmlOutputLabel;
import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.event.ActionEvent;
@ViewScoped
public class PanelGroupUpdater1 {
private HtmlPanelGroup hpg0;
@PostConstruct
public void init(){
hpg0=new HtmlPanelGroup();
hpg0.setLayout("block");
hpg0.setStyleClass("myBindedPanelGroup0");
HtmlOutputLabel l = new HtmlOutputLabel();
//l.setValue("Synched binded panel group : ");
hpg0.getChildren().add(l);
}
int h;
public void addLabelBindedSynched(ActionEvent event) {
//update panelgroup by its binding
HtmlOutputLabel l = new HtmlOutputLabel();
l.setValue("added:"+(++h)+";");
this.hpg0.getChildren().add(l);
}
}
and the WebContent/test/bindingtest.xhtml
<h:body>
<f:view>
Binded panel group (hpg0) : <br/>
<h:panelGroup id="myBindedPanelGroup0" binding="#{panelGroupUpdaterBean1.hpg0}" layout="block">
</h:panelGroup>
<h:form>
<h:commandButton value="Add Label (binded)" actionListener="#{panelGroupUpdaterBean1.addLabelBindedSynched}" update=":myBindedPanelGroup0" />
</h:form>
</f:view>
</h:body>
the thing is I can add label to panelgroup just once but all next adding attempts I get this exception java.lang.IllegalStateException: CDATA tags may not nest
.
So my question is... what causes the issue and how to fix that?
Thanks