Thursday 15 September 2011

java - Don't escape th:content tag in Thymeleaf -



java - Don't escape th:content tag in Thymeleaf -

i'm working in spring boot project thymleaf 2.1.3 . i'm adding meta tags page, doing:

<meta name="pagename" th:content="${pagename}"/>

the pagename variable filled in controller. works, fact pagename html escaped. wrong behaviour application. sanitize info myself, after should place raw within content tag.

i've looked around , found th:inline, doesn't work content tags. found th:utext, doesn't work th:content..

does know solution problem?

thanks!

as far know thymeleaf escape content going html attributes, consistent the xml/html spec dictates content should escaped. said there may couple of workarounds discussed on forum others trying same thing: http://forum.thymeleaf.org/how-to-get-unescaped-text-into-title-attribute-td4027791.html

one involves creating own attribute processor, other syntax hack.

do have sanitise content first? can not allow thymeleaf in view layer?

java html spring escaping thymeleaf

No comments:

Post a Comment