[ 
https://issues.apache.org/jira/browse/WICKET-4779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460827#comment-13460827
 ] 

Brian Laframboise commented on WICKET-4779:
-------------------------------------------

Sure enough, when I apply the following changes:

HomePage.java

public class HomePage extends WebPage {
  private final WebMarkupContainer body;

  public HomePage(final PageParameters parameters) {
    super( parameters );
    body = new TransparentWebMarkupContainer( "body" );
    add( body );
  }
}

ChildPage.java

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

then the fragment gets resolved as I expect. Thanks for you help!

I had looked over the 1.5 Migration Guide 
(https://cwiki.apache.org/WICKET/migration-to-wicket-15.html) but my 
interpretation of the guide did not address this issue. Is there a way I could 
contribute this example to the guide?
                
> 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

Reply via email to