[ https://issues.apache.org/jira/browse/WICKET-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009677#comment-13009677 ]
Pedro Santos commented on WICKET-3512: -------------------------------------- Initial investigation shows that AbstractMarkupFilter has an counter variable giving the same value to both enclosure components. the markup loader load TestPage3.html the parser create the "enclosure_1" the markup loader load TestPanel2.html, create a new set of filters, the counter is created again having its initial value the parser create the "enclosure_1" again Changing EnclosureHandler or WicketTagIdentifier to assign different wicket ids fix the problem. But I still don't know why, I see nested components with identical wicket ids working all the time. > <wicket:enclosure> results in MarkupException when used with multiple > <wicket:child> > ------------------------------------------------------------------------------------ > > Key: WICKET-3512 > URL: https://issues.apache.org/jira/browse/WICKET-3512 > Project: Wicket > Issue Type: Bug > Affects Versions: 1.5-RC2 > Reporter: Robin Shine > Assignee: Pedro Santos > > Put below simple pages into a Wicket web application: > TestPage1.html: > <html> > <head> > <title>title</title> > </head> > <body> > <div wicket:id="test1"></div> > <wicket:child></wicket:child> > </body> > </html> > TestPage1.java: > package com.example.test; > import org.apache.wicket.markup.html.WebPage; > import org.apache.wicket.markup.html.basic.Label; > public class TestPage1 extends WebPage { > public TestPage1() { > add(new Label("test1", "test1")); > } > } > TestPage2.html: > <wicket:extend> > <wicket:enclosure child="test2"> > <div wicket:id="test2"></div> > </wicket:enclosure> > <wicket:child></wicket:child> > </wicket:extend> > TestPage2.java: > package com.example.test; > import org.apache.wicket.markup.html.basic.Label; > public class TestPage2 extends TestPage1 { > > public TestPage2() { > add(new Label("test2", "test2")); > } > } > TestPage3.html: > <wicket:extend> > <wicket:enclosure child="test3"> > <div wicket:id="test3"></div> > </wicket:enclosure> > </wicket:extend> > TestPage3.java: > package com.example.test; > import org.apache.wicket.markup.html.basic.Label; > public class TestPage3 extends TestPage2 { > > public TestPage3() { > add(new Label("test3", "test3")); > } > } > Here TestPage3 extends TestPage2, and TestPage2 extends TestPage1. Both > TestPage2.html and TestPage3.html contains a <wicket:enclosure> tag. Now > mount TestPage3 and access it, below errors will be generated: > Message: The component [Component id = test2] was rendered already. You can > render it only once during a render phase. Class relative path: > org.apache.wicket.markup.html.basic.Label:test2 > Root cause: > org.apache.wicket.markup.MarkupException: The component [Component id = > test2] was rendered already. You can render it only once during a render > phase. Class relative path: org.apache.wicket.markup.html.basic.Label:test2 > at org.apache.wicket.Page.componentRendered(Page.java:299) > at org.apache.wicket.Component.rendered(Component.java:2570) > at org.apache.wicket.Component.internalRender(Component.java:2377) > at org.apache.wicket.Component.render(Component.java:2301) > at > org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415) > ... > This error won't occur if <wicket:enclosure> is removed from one of the page. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira