This is my first post on this forum, so don't shoot me if I posted in the wrong topic.
I have a springboot MVC app, which has a registerform, when there is wrong input from the user the controller add's an error message to the model which is then shown on the bottom of the page.
Everything is working fine, but for some reasson my message is concatenated all together.
I tried "\n", System.lineSeparator() and even knowing html is not redered, I also tried <br>, non of these worked.
When I print the errormessage to the console it's formatted corectly, so the prob is in my template.
I use a StringBuilder tobuild the message and then call the toString method when passing it to the model.
Anyone an idea how to solve my issue?
I think Paul is right. Thymeleaf escapes your input when you use th:text. Note that whitespace like line breaks don't matter because in HTML these show up as a single space. The <br> tag is the way to go as long as you tell Thymeleaf not to escape it.