[ACCEPTED]-How to display html text within a Wicket element?-wicket

Accepted answer
Score: 28

Found this in the excellent Manning Wicket 10 in Action:

add(new Label("markup", "<h1>Hello!</h1>").setEscapeModelStrings(false));

The call to setEscapeModelStrings 9 tells Wicket not to escape the contents 8 of the provided string, and to render the 7 contents into the resulting markup. This 6 does the trick, as you can see in the right 5 screenshot in figure 5.4. Note that this 4 setting is available on all Wicket components, but 3 it’s primarily useful on labels.

As the book 2 also notes however, you should be aware 1 of script-injection attacks..

More Related questions