How to ignore HTML tags in printing text string?

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

How to ignore HTML tags in printing text string?

mercury
This post was updated on .
Hello
I'm trying to print text string with some HTML tags.
Using
<p th:text="${myString}"> </p>
 I've got something like this:
<b> text </b>
And that's ok because the value of myString text string is
"<b> text </b>"
.

Using
<p th:utext="${myString}"> </p>
I've got something like this:
text

But my goal ist to get non-formatted plain text like this:
text

Without any HTML tags and without rendering the HTML code.
How can I acheive this with using Thymeleaf only?
I've tried some th:remove="tags" along with th:inline="text" but It doesn't work so far.

Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: How to ignore HTML tags in printing text string?

Switch
Either I don't know what your asking or your very new to HTML.  th: is only used when you want ThymeLeaf to interpret code.   Just use any HTML tags by themselves.

<span>text</span>
Reply | Threaded
Open this post in threaded view
|

Re: How to ignore HTML tags in printing text string?

mercury
Ok, thanks.
Well, I see now that I used some shortcuts so it can be a little bit difficult to understand.

Of course I'm using it along with HTML tag.
I fixed my first post.