well,
markup inheritance lets you create pages (or panels for that mater) with the
same layout.
Suppose you want to have two pages that both have (the same) header and a
footer.
Markup inheritance is a way of doing that (there are other options as well).

So what you do is, create a Base page.
In that page you will add the header and footer normally as in any Wicket
page.
the html will look something like:
<html>
<body>
<div wicket:id="header"></div>
<wicket:child/>
<div wicket:id="footer"></div>
</body>
</html>

* I eliminate the java code as it is supposed to be simple.
But remember, you add the header and footer wicket components in THIS page

Now, in pages SubA and SubB you can add whatever you want. It will be put
where the wicket:child is located.
So,
1. in the html
<html>
<body>
<wicket:extend>
... Here all the sub stuff will be put
</wicket:extend>
</body>
</html>

* actually the <html> and even the <body> tags are not really necessary, but
I am used to put them so my IDE won't get crazy :)

In the java you need to extend the base and add the components according to
the ones you added in the html.
you DON'T need to add the header and footer in the subclasses.

Eyal Golan
[email protected]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Fri, Aug 14, 2009 at 10:53 AM, Oliver-Sven Fritsch <[email protected]>wrote:

> Hi everybody!
>
> I'm really new to wicket and it's concepts. I so far created a very simple
> page having some div containers and some static text. What I want to do now
> is to include a page header. What I tried is to use the wicket:extend and
> wicket:child tags to get thing working but with no success. I have my two
> pages Index and Header. Having some basic jsp experience I thought extending
> should work like <jsp:include>. When I try to get my header into the index
> page nothing is showing up.
>
> Code of Index.html
> <html>   <head><title>some titlet</title>
>       <link rel="stylesheet" type="text/css" href="styles.css"/>
> </head>
>   <body>
>       <div id="page">
>           <div id="header">
>               <wicket:child/>
>           </div>
> [....]
>
> Code of Header.html
> <html>
>   <head></head>
>   <body>
>   <wicket:extend>
>       <div id="header">
>           <h1>Header.html</h1>
>       </div>
>   </wicket:extend>
>   </body>
> </html>
>
> Maybe I'm getting things totally wrong?
>
> Another thing I wonder about is how does wicket know which page to include?
>
> Thanks in advance!
>
> Oliver
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to