Rendering html using thymeleaf

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering html using thymeleaf

Reza
Hi,

I was wondering how I could render html using thymeleaf. My model object has html values in one of its fields and I need to render it as it is but what I get is an html encoded string like <h1>Content2</h1>
 in the page source.

Can anyone advise please?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering html using thymeleaf

danielfernandez
Administrator
Hi,

You should have a look at the "th:utext" attribute, with renders "unescaped text", which in your case will allow you to display your HTML correctly...

Regards,
Daniel.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering html using thymeleaf

Reza
Thanks you very much. :) That is exactly what  I was looking for.