覆盖grails.views.default.codec ='html'config回到'none' [英] Overriding grails.views.default.codec='html' config back to 'none'

查看:125
本文介绍了覆盖grails.views.default.codec ='html'config回到'none'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Grails(< 2.3)中,如果我在Grails Config.groovy中留下 grails.views.default.code ='none',则由我决定HTML在GSP文件中显式编码我的表达式: $ {myValue?.encodeAsHTML()}



在Config.groovy中设置 grails.views.default.codec ='html,那么HTML编码会针对每个表达式自动进行: $ {myValue我的问题:如果我将默认设置为'html'


'none' >解决方案

如果默认编码级别设置为html使用



grails.views.default.codec = html



然后删除您可以使用的页面中的一个表达式的html编码



$ {raw(expression)}


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()}.

If I set grails.views.default.codec='html" in the Config.groovy, then the HTML encoding happens automatically for every expression: ${myValue}.

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?

解决方案

If default encoding level is set to html using

grails.views.default.codec = "html"

then for removing the html encoding for one expression in a page you can use

${raw(expression)}

这篇关于覆盖grails.views.default.codec ='html'config回到'none'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆