Brian Laframboise created WICKET-4779:
-----------------------------------------

             Summary: 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


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}}
{code}
public class HomePage extends WebPage {
        public HomePage(final PageParameters parameters) {
                super( parameters );
                // remove body and error no longer appears
                add( new WebMarkupContainer( "body" ) );
        }
}
{code}

{{HomePage.html}}
{code}
<html xmlns:wicket="http://wicket.apache.org";>
  <!-- remove wicket-id of body and error goes away -->
  <body wicket:id='body'>
    <wicket:child/>
  </body>
</html>
{code}

{{ChildPage.java}}
{code}
public class ChildPage extends HomePage {
        public ChildPage(final PageParameters parameters) {
                super( parameters );
                add( new Fragment( "placeholder", "fragment", this ) );
        }
}
{code}

{{ChildPage.html}}
{code}
<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>
{code}

The error generated is:

{code}
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)
        ...
{code}

--
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

Reply via email to