using the
@PageTitle
annotationimplementing
HasDynamicTitle
Java
Note | The @PageTitle annotation is read from the actual navigation target only; neither its superclasses nor its parent views are considered. |
Implementing the interface HasDynamicTitle
allows us to change the title from Java at runtime:
@Route(value = "blog")
implements HasDynamicTitle, HasUrlParameter<Long> {
private String title = "";
@Override
public String getPageTitle() {
return title;
}
public void setParameter(BeforeEvent event,
@OptionalParameter Long parameter) {
title = "Blog Post #" + parameter;
} else {
title = "Blog Home";
}
}
See also: