I have a string (user message) and I would like to find (using regexp) special codes in it and replace them with links. (For example, @user will be replaced with <a href="wicket-url-to-user-profile">user</a> thing.) How can it be done in the Wicket? I do not ask about regular expressions, it is Wicket-focused question.
I have a string (user message) and I would like to find (using regexp)
Share
In fact, Wicket has a very powerful feature for this.
Let’s say this is your localization string with the key “some.resource.key”:
Then you add the following to your Wicket template:
In your Wicket page (or Panel), simply add your link as if you were adding it to the level where you put the wicket:message:
Now the link – you can use whatever implementation of link or any other component you like – is displayed correctly embedded in your localized string.