Process thymeleaf variable as html code and not text

前端 未结 2 1199
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 13:46

I\'m using Thymeleaf to process html templates, I understood how to append inline strings from my controller, but now I want to append a fragment of html code into the page.

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 14:00

    If you want short-hand syntax you can use following:

    [(${variable})]
    

    Escaped short-hand syntax is

    [[${variable}]]
    

    but if you change inner square brackets [ with regular ( ones HTML is not escaped.

    Example within tags:

    [(${variable})]

提交回复
热议问题