Thymeleaf parse text and execute in-text expressions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Thymeleaf parse text and execute in-text expressions

I have text string, that contains links, for example, like <a th:href="'someLink'">Download</a> .

I need to process that text and replace th:href="'someLink'" with correct links to show text with <a href="someLink">Download</a>.

The text with links is stored in variable textThatContainsLinks.

My code to show text is <div th:utext="${textThatContainsLinks}">. I also tried to use preprocessing like <div th:utext="${__textThatContainsLinks__}">.

Currently this code shows links not as I expected, but non-preprocessed, ie, output is <a th:href="'someLink'">Download</a> now.

How to pre-process expressions in text, before showing it?

Thank you very much!