[
https://issues.apache.org/jira/browse/WICKET-4779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460501#comment-13460501
]
Martin Grigorov commented on WICKET-4779:
-----------------------------------------
The change that broke this has been made in Wicket 1.5.0.
It was part of simplification of code related to auto-components.
The fragment's markup is really in the WebMarkupContainer, not in the page as
your Java code states. This worked in 1.4 by chance.
Additionally if the markup was found then the next error would be that the
component hierarchy is not correct. The "body" component is not "transparent"
so adding "fragment" to 'this' is not the expected body.add(fragment).
> Fragments within elements with wicket components are no longer found
> --------------------------------------------------------------------
>
> Key: WICKET-4779
> URL: https://issues.apache.org/jira/browse/WICKET-4779
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.0.0
> Reporter: Brian Laframboise
> Attachments: WICKET-4779-quickstart.zip
>
>
> During a migration from Wicket 1.4.21 to 6.0.0, I've discovered that during
> Fragment resolution Wicket will no longer find a Fragment if the Fragment is
> nested within an element that has a wicket component attached to it.
> Here's the pertinent excerpts from the attached quickstart which reproduces
> the issue:
> HomePage.java
> public class HomePage extends WebPage {
> public HomePage(final PageParameters parameters) {
> super( parameters );
> // remove body and error no longer appears
> add( new WebMarkupContainer( "body" ) );
> }
> }
> HomePage.html
> <html xmlns:wicket="http://wicket.apache.org">
> <!-- remove wicket-id of body and error goes away -->
> <body wicket:id='body'>
> <wicket:child/>
> </body>
> </html>
> ChildPage.java
> public class ChildPage extends HomePage {
> public ChildPage(final PageParameters parameters) {
> super( parameters );
> add( new Fragment( "placeholder", "fragment", this ) );
> }
> }
> ChildPage.html
> <html xmlns:wicket="http://wicket.apache.org">
> <wicket:extend>
> <div wicket:id='placeholder'>[Placeholder]</div>
> <wicket:fragment wicket:id='fragment'>Fragment</wicket:fragment>
> </wicket:extend>
> </html>
> The error generated is:
> Failed to handle: <wicket:container wicket:id="placeholder">. It might be
> that no resolver has been registered to handle this special tag. But it also
> could be that you declared wicket:id=placeholder in your markup, but that you
> either did not add the component to your page at all, or that the hierarchy
> does not match.
> MarkupStream: [markup =
> file:/C:/dev/workspaces/eclipse32/quickstart/myproject/target/classes/com/mycompany/ChildPage.html
> <wicket:extend>
> <wicket:container wicket:id="placeholder">[Placeholder]</wicket:container>
> <wicket:fragment wicket:id="fragment">Fragment</wicket:fragment>
> </wicket:extend>, index = 2, current = '<wicket:container
> wicket:id="placeholder">' (line 0, column 0)]
> at
> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526)
> at
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1415)
> ...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira