Problem with removing children of the component

Hello,

Is it correct that i can remove only elements which are created dynamically (they are not present in xhtml)?

Example:

1. Icannot remove children of the component which are present in xhtml file

<h:form id="form">

...

<h:panelGroup binding="#{bean.panelGroup}" id="panel">

<h:outputText value="something" id="text"></h:outputText>

</h:panelGroup>

</h:form>

inside some action of the bean:

UIComponent ot = FacesContext.getCurrentInstance().getViewRoot().findComponent("form:text");

panelGroup.getChildren().remove(ot);// does not work

// ot is still displayed regardless that getChildCout() is 0

2. Ican remove a child which is created dynamically

HtmlOutputText ot2 =new HtmlOutputText();

ot2.setValue("new text");

ot2.setId("tttt");

panelGroup.getChildren().add(ot2);

//now ot2 is displayed

....

panelGroup.getChildren().remove(ot2);// it works

//ot2 will not be displayed;

[1464 byte] By [froggga] at [2007-11-27 2:35:47]
# 1
> Is it correct that i can remove only elements which> are created dynamically (they are not present in> xhtml)?It is correct, because they still remains in the xhtml. Rather use setRendered(false).
BalusCa at 2007-7-12 2:54:29 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...