Friday, 5 January 2018

wicket:message with links and labels inside

wicket:message can contain markup inside of itself. It is an easy thing to do, but not quite obvious that it's allowed to do that.

For example wicket:message with a link and a label:

<wicket:message key="myMessage">
    <span wicket:id="myLabel" />
    <a wicket:id="myLink" />
add(new Label("myLabel", myLabelModel));
add(new LabelledBookmarkablePageLink("myLink", ViewSomethingPage.class));
myMessage = a text before a label ${myLabel}, between label and a link ${myLink}, after link
myLink= My Link Text

${myLabel} and ${myLink} of myMessage will be replaced with appropriate components