0

I have text with paragraphs in Data Base, I can see this text with System.out.println(); in java, but when I show this text on UI I see all text in one line.Data Base

Spring:

    ModelAndView modelAndView = new ModelAndView();
    modelAndView.addObject("allText",dtos);
    modelAndView.setViewName("test");
    return modelAndView;

So I try to show on UI:

 <div th:each="text: ${allText}">
      <div align="center" >
          <b><span th:text="${text.description}">description</span></b>
      </div>
 </div>

Where my mistake?

Viking
  • 177
  • 5
  • 16

1 Answers1

0
th:utext="${#strings.unescapeJava(#strings.replace(#strings.escapeJava(text.description),'\n','&lt;br /&gt;'))}"
Viking
  • 177
  • 5
  • 16
  • 1
    While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – DimaSan Mar 15 '17 at 11:14
  • I can't find answer on my question, Metroids give some similar links and I show solving of my problem – Viking Mar 15 '17 at 13:22
  • @Viking did you check this link? http://stackoverflow.com/questions/23156585/process-thymeleaf-variable-as-html-code-and-not-string – cralfaro Mar 15 '17 at 13:55