Using the “escape“ directive (legacy escaping) is not allowed when auto-escaping is on with a markup

Using the “escape“ directive (legacy escaping) is not allowed when auto-escaping is on with a markup,第1张

Using the “escape“ directive (legacy escaping) is not allowed when auto-escaping is on with a markup

springboot 2.3.0+版本以上,springboot自动引用freemarker模板文件的后缀从.ftl变成了.ftlh


<#escape x as x?html>
<#include "../common/macro.ftl">


而且,如果使用如上述的freemarker代码段,会报Using the "escape" directive (legacy escaping) is not allowed when auto-escaping is on with a markup 的错误,意思就是重复escape。

因为会帮你默认

<#escape x as x?html>

然后你的代码里也加了这个的话,就会2次escape,所以删掉你模板里的escape语句即可

stackoverflow也有类似的问题Freemarker 2.3.24 auto-escape and spring.ftl macros issue - Stack Overflowhttps://stackoverflow.com/questions/37298463/freemarker-2-3-24-auto-escape-and-spring-ftl-macros-issue

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5523015.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-13
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存