Hi,

Try to take a look at this example:

http://wicket.apache.org/examplemarkupinheritance.html

Frank


On Jan 7, 2008 4:05 AM, Danilo Barsotti <[EMAIL PROTECTED]> wrote:

> Hi all!
>
> I have a question about how to create a consistent layout with wicket.
>
> now I have a index class and all other classes extends it.
>
> <code>
> public class Index extends WebPage {
>
>    private static final long serialVersionUID = 1L;
>
>
>    protected String getName(){
>        return "Title here";
>    }
>
>
>    /**
>     * Constructor that is invoked when page is invoked without a session.
>     *
>     * @param parameters
>     *            Page parameters
>     */
>    public Index(final PageParameters parameters) {
>        add(new Label("title",new Model(getName())));
>
>        add(new BookmarkablePageLink("page1", Page1.class));
>        add(new BookmarkablePageLink("page2", Page2.class));
>        add(new BookmarkablePageLink("login", Login.class));
>
>        add(new Label("footer","it is a footer"));
>    }
> }
>
>
>
> public class Page1 extends Index{
>
>    private static final long serialVersionUID = 1L;
>
>    public Page1(PageParameters parameters) {
>        super(parameters);
>        add(new Label("label1", "This is in the subclass Page1"));
>    }
>
> }
> </code>
>
> HTML:
>
> <code>
>
> <html xmlns:wicket="http://wicket.sourceforge.net/";>
> <head>
> <title wicket:id="title"></title>
> </head>
>    <body>
>        <div id="header">
>            <br>
>            <a href="#" wicket:id="page1">Page1</a>
>            <a href="#" wicket:id="page2">Page2</a>
>            <a href="#" wicket:id="login">Login</a>
>            <br><br>
>        </div>
>        <div id="body">
>            <br>
>            <wicket:child />
>            <br>
>        </div>
>        <div id="footer">
>            <br><br>
>            <span wicket:id="footer"></span>
>        </div>
>    </body>
> </html>
>
> </code>
>
> my question is, this code is correct?
> other better method to make this? suggestion, tip ...
>
> thanks and sorry my english poor!
>

Reply via email to