How to output ${expression} in Freemarker without it being interpreted?

后端 未结 8 1144
隐瞒了意图╮
隐瞒了意图╮ 2020-12-05 06:39

I\'m trying to use Freemarker in conjunction with jQuery Templates.

Both frameworks use dollar sign/curly brackets to identify expressions for substitution (or as th

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 07:14

    This should print ${person.name}:

    ${r"${person.name}"}
    

    From the freemarker docs

    A special kind of string literals is the raw string literals. In raw string literals, backslash and ${ have no special meaning, they are considered as plain characters. To indicate that a string literal is a raw string literal, you have to put an r directly before the opening quotation mark or apostrophe-quote

提交回复
热议问题