Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thymeleaf - How to pass HTML to the div?

How to pass HTML from a variable to a div?

I have code

<div class="content" th:text="${ourService.getShortText()}" />

But it shows not HTML in the div, but escaped HTML as div text. How to pass the variable's value not as an escaped text, but as inner HTML of the div?

like image 512
Arthur Avatar asked Feb 04 '15 15:02

Arthur


1 Answers

The solution is as follows:

<div class="content" th:utext="${ourService.getShortText()}" />
like image 136
Arthur Avatar answered Sep 24 '22 13:09

Arthur