This is wrong
...
      <wicket:extend>
            <span wicket:id="subLabel">sub label</span>
        </wicket:extend>

        <wicket:child/>
...

must be
      <wicket:extend>
            <span wicket:id="subLabel">sub label</span>
            <wicket:child/>
        </wicket:extend>


Juergen

On 11/10/05, Ramnivas Laddad <[EMAIL PROTECTED]> wrote:
Hi,

I am trying to use wicket:extend mechanism to share common functionality between pages and it seem to work only with one level of hierarchy. When I add another level, I get error (pasted below). Am I doing something incorrectly?

Here is code to reproduce the behavior:
Base.html:
<html>
    <body>
        <span wicket:id="baseLabel">base label</span>
       
        <wicket:child/>
    </body>
</html>

Sub.html:
<html>
    <body>
        <wicket:extend>
            <span wicket:id="subLabel">sub label</span>
        </wicket:extend>

        <wicket:child/>
    </body>
</html>

SubSub.html:
<html>
    <body>
        <wicket:extend>
            <p>Sub sub</p>
        </wicket:extend>
    </body>
</html>

Base.java:
package com.aspectivity.wicket.bugs;

import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;

public class Base extends WebPage {
    public Base() {
        add(new Label("baseLabel", "This is label added by base"));
    }
}

Sub.java:
package com.aspectivity.wicket.bugs;

import wicket.markup.html.basic.Label;

public class Sub extends Base {
    public Sub() {
        add(new Label("subLabel", "This is label added by sub"));
    }
}

SubSub.java:
package com.aspectivity.wicket.bugs;

public class SubSub extends Sub {
}

With this code, I get the following exception:

wicket.markup.MarkupNotFoundException: Markup of type 'html' for component 'com.aspectivity.wicket.bugs.SubSub' not found. Enable debug messages for wicket.util.resource.Resource to get a list of all filenames tried:
[Page class = com.aspectivity.wicket.bugs.SubSub, id = 0]
at wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:720)
at wicket.Page.onRender(Page.java:778)
at wicket.Component.render (Component.java:1163)
at wicket.Page.doRender(Page.java:251)
at wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:276)
at wicket.RequestCycle.respond(RequestCycle.java:934)
at wicket.RequestCycle.request(RequestCycle.java:411)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:208)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
at org.mortbay.http.HttpContext.handle (HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java :961)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java :300)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:511)
Caused by: wicket.WicketRuntimeException: Expected to find <wicket:child/> in base markup
at wicket.markup.InheritedMarkupMerger.mergeMarkups (InheritedMarkupMerger.java:209)
at wicket.markup.MarkupCache.checkForMarkupInheritance(MarkupCache.java:418)
at wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:225)
at wicket.markup.MarkupCache.loadMarkupAndWatchForChanges (MarkupCache.java:300)
at wicket.markup.MarkupCache.getMarkup(MarkupCache.java:183)
at wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java:100)
at wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java :83)
at wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:710)
... 22 more
      <wicket:extend>

            <span wicket:id="subLabel">sub label</span>

        </wicket:extend>



        <wicket:child/>

Component Tree

Component tree for [Page class = com.aspectivity.wicket.bugs.SubSub, id = 0]:

# Path Type Model Object
1    baseLabel    wicket.markup.html.basic.Label    This is label added by base   
2    subLabel    wicket.markup.html.basic.Label    This is label added by sub  

-Ramnivas




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to