Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicket panel component doesnt recognize newlines

Tags:

java

panel

wicket

Im new to wicket. Why doesn't /n add a new line to a string in a panel component? the /n just gets left out and the string continues as normal.

like image 671
ollo Avatar asked Dec 01 '22 00:12

ollo


2 Answers

Its because its rendered as HTML and HTML does not recognize \n as new lines. Instead it is treated as a normal white space.

If you want a new line, insert a <br> into your string and use setEscapeModelStrings(false) on your component.

like image 127
magomi Avatar answered Dec 05 '22 09:12

magomi


Or if your component is a label, you can consider using MultiLineLabel

like image 39
biziclop Avatar answered Dec 05 '22 10:12

biziclop