Grails 和 Google PlusOne
Google PlusOne 代码如下所示:
不幸的是,在 Grails 世界中,“g:”是保留的。
我相信您可以修改 Grails 库,但我正在寻找一种更简单的方法。 我怎样才能简单地要求 Grails 不解析这个字符串?
The Google PlusOne code looks like: <g:plusone size="medium"></g:plusone>
Unfortunately, in Grails world, "g:" is reserved.
I believe you can modify the Grails library, but I'm looking for an easier way.
How can I simply ask Grails to NOT PARSE this string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我将回答我自己的问题,并感谢昆汀,他对问题发表了评论,但没有写下答案(如果您发布答案,我将选择您作为正确答案)。
有一个 HTML 版本:
I will answer my own question and give credit to Quentin, who commented on the question but did not write an answer (if you post the answer, I will select you as the correct answer).
There is an HTML version:
或者您可以在 gsp 文件中像这样输出:
Or you may output it like this in your gsp file:
好吧,您唯一的解决方案是更改您正在使用的标签库。
如果您使用 taglib,您唯一必须做的就是添加一个名为 namespace 的静态属性,其名称为您想要的名称,如下例所示:
Well, the only solution you have is to change the taglib which you are using.
If you are using a taglib, the only thing you must do is add a static attribute named namespace with the name you want, like the following example:
基于 James Williams 的 taglib 解决方案,我能够使用此 taglib 呈现 +1 按钮,我在 taglib 文件夹中将其命名为 GooglePlusOneTagLib.grooovy:
然后您只需在 gsp 中使用这些标签即可
building on the taglib solution by James Williams, I was able to render a +1 button with this taglib, which I named GooglePlusOneTagLib.grooovy in my taglib folder:
and then you just use these tags in your gsp