如何在Groovy的SimpleTemplateEngine中转义特殊字符?

时间:2022-05-22 22:29:25

By default, groovy's SimpleTemplateEngine uses <% %> as the scriptlet container. How do I escape these characters if I want to print out <% %>?

默认情况下,groovy的SimpleTemplateEngine使用<%%>作为scriptlet容器。如果要打印<%%>,如何转义这些字符?

2 个解决方案

#1


Looks like it might be a bug

看起来这可能是一个错误

http://jira.codehaus.org/browse/GROOVY-399

#2


The book I've red (which might be outdated) says that you need to have variable that contains <% and %> and then you need to output those variables.

我红色的书(可能已经过时)说你需要包含<%和%>的变量,然后你需要输出这些变量。

#1


Looks like it might be a bug

看起来这可能是一个错误

http://jira.codehaus.org/browse/GROOVY-399

#2


The book I've red (which might be outdated) says that you need to have variable that contains <% and %> and then you need to output those variables.

我红色的书(可能已经过时)说你需要包含<%和%>的变量,然后你需要输出这些变量。