将 grails.views.default.codec='html' 配置覆盖回 'none' [英] Overriding grails.views.default.codec='html' config back to 'none'
问题描述
在 Grails (<2.3) 中,如果我将 grails.views.default.code='none'
留在 grails Config.groovy 中,则由我来对我的表达式进行 HTML 显式编码GSP 文件:${myValue?.encodeAsHTML()}
.
In Grails (<2.3), if I leave grails.views.default.code='none'
in the grails Config.groovy, it's up to me to HTML encode my expressions explicitly in the GSP files: ${myValue?.encodeAsHTML()}
.
如果我在 Config.groovy 中设置了 grails.views.default.codec='html"
,则 HTML 编码会自动为每个表达式进行:${myValue}
.
If I set grails.views.default.codec='html"
in the Config.groovy, then the HTML encoding happens automatically for every expression: ${myValue}
.
我的问题:如果我将默认值设置为 'html'
,当我不想要 HTML 时,如何回到 'none'
一个表达式编码行为?
My question: If I set the default to 'html'
, how do I get back to 'none'
for one expression when I don't want the HTML encoding behavior?
推荐答案
如果使用
grails.views.default.codec = "html"
然后删除页面中一个表达式的html编码,您可以使用
then for removing the html encoding for one expression in a page you can use
${raw(expression)}
这篇关于将 grails.views.default.codec='html' 配置覆盖回 'none'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!