The way I do it is; dont specify a title in your base page then just add the
title in the subpage:

base page.html
<html>
<!-- anything shared in all the pages eg a base.css file -->
<head>
</head>
<body>
   <wicket:child/>
</body>
</html>

subpage.html:

<wicket:head>
        <title>hard code or use wicket label to add this</title>
</wicket:head>
<wicket:extend>
      <!-- anything ... -->
</wicket:extend>

subpage.java

Richard



hbf wrote:
> 
> I am using markup inheritance (<wicket:child> and <wicket:extend>)  
> and need to set the
> page title from my subpage. I currently add a label in the base class  
> (BasePage.java)
> and make it use an abstract method getTitle(), which is overridden in  
> the subclass
> (SubPage.java). Has anybody found a better way?
> 
> Here's my solution:
> 
> <!-- BasePage.html -->
> <html>
> <head>
>    <title wicket:id="title">[Page title]</title>
> </head>
> <body>
>    <wicket:child/>
> </body>
> </html>
> 
> <!-- SubPage.html -->
> <wicket:extend>
>    <!-- anything ... -->
> </wicket:extend>
> 
> 
> public abstract class BasePage extends WebPage
> {
>    // ...
>    public BasePage(final PageParameters parameters)
>    {
>      add(new Label("title", new PropertyModel(this, "title")));
>    }
>    public abstract String getTitle();
> }
> 
> public class SubPage extends BasePage
> {
>    // ...
>    public String getTitle()
>    {
>      return "whatever title";
>    }
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to