I have a tag in page which contains HTML content. I want web browser to render (not display) that page. So I use utext attribute as suggested. So it worked as expected but failed for following content
B&B company. <br>some random text</br>.
It is failing because of '&'. I think, it will be escaped as other characters(like <,>) but apparently it is not.
What the "th:utext" attribute does is, precisely, output *unescaped* text. That's why your <br>'s will render as line feeds instead of visible tags. "th:utext", therefore, allows you to directly output HTML code.
But "B&B" is not valid HTML. If you want to display that using a "th:utext", you'd need your String to be "B&B".