Reputation: 3473
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
?
Upvotes: 12
Views: 15131
Reputation: 3473
The solution is as follows:
<div class="content" th:utext="${ourService.getShortText()}" />
Upvotes: 24