> 1. Set an instance variable in the base page called basePageName

You don't need a variable - all you need is a getter:

public IModel<String> getPageTitleModel() {
  return new Model("ApplicationName");
}


> 2. Use a Label to set the title in the base page


Exactly, like this:

add(new Label("pageTitle", getPageTitleModel());


>
> 3. Let child pages append their part to the Label
>

public IModel<String> getPageTitleModel() {
  return new Model("ApplicationName - Cool Page");
}


Another approach (this way you handle localization and don't have to
override anything in your pages):

public IModel<String> getPageTitleModel() {
  return new StringResourceModel(this.getClass().getSimpleName() +
".PageTitle", this, null);
}

and put

CoolPage.PageTitle=ApplicationName - Cool Page Title

into your application properties file.

Reply via email to