Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
1.2.6, 1.2.7
-
None
-
None
-
None
-
Windows XP Pro, Tomcat 6.20, Facelets x.14/x.15
Description
Child components added dynamically at end appears as first child when rendered. Here is a highly simplified case of the problem (source included):
The custom component 'repeat' will simply iterate through its children and renders them.
Usage:
<netx:repeat binding="#
{testBean.htmlRepeat}">
<h:outputText value="Child-1"/>
<h:outputText value="Child-2"/>
</netx:repeat>
Below is how the component renders:
[begin - Child-1Child-2 - end]
BackingBean:
The repeat component is bounded to a backing bean like so:
public class TestBean {
private HtmlRepeat htmlRepeat;
public HtmlRepeat getHtmlRepeat()
{ return null; }public void setHtmlRepeat(HtmlRepeat htmlRepeat)
{ this.htmlRepeat = htmlRepeat; } // – action method
public String formSubmitted()
}
and the form is submitted using <h:commandButton value="Submit" action="#
{testBean.formSubmitted}"/>
The formSubmitted() method simply adds a child to htmlRepeat using htmlRepeat.getChildren().add(child). Note that the child is added as the last
child to the children list. But when the response is rendered, the newly added child appears at the beginning.
Expected Output:
[begin - Child-1Child-2Child-3 - end]
Actual Output:
[begin - Child-3Child-1Child-2 - end]
Attachments:
1. jsf-repeat.jar - Deployable JSF component packaged as jar (contains .java
files, faces-config.xml and facelet taglib).
Download >> http://keerthi.linux.googlepages.com/jsf-repeat.jar
2. TestRepeat.xhtml - Facelet view using the <netx:repeat/> custom component
Download >> http://keerthi.linux.googlepages.com/TestRepeat.xhtml (Use Save
target as, otherwise you will get only a blank page)
Note: Tested on myfaces1.2.6/Tomcat 6.20/Facelets .14 & .15