I have some text which I want to have on separate lines.
I try to println this with label:
add(new Label("output",output));
<span wicket:id="output">Will be replaced</span>
Problem with this code it that it is ignoring formatting new line. Is there better way how to println some text?
There are two options:
Use a
<pre />(as in: preformatted) tag instead of<span />. If you have new line markers in your text, it will work, because browsers do not format text that is placed inside the<pre />tag.Use Wicket’s
MultiLineLabelclass. After the Javadoc:Note, that if using the MultiLineLabel class, you should not use a
<span />tag in your HTML, as placing paragraphs (<p />) inside<span />is considered bad practice.