使用 Sitemesh 装饰器提取 DIV 的内容
我想知道如何使用装饰器提取特定 DIV 的内容,而不是使用
来获取 内的所有内容;
标签。
I would like to know how I can extract the content of a specific DIV using decorators, instead of using <decorator:body />
which will fetch all the content inside the <body>
tag.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在使用的 sitemesh 版本 2.4.2 是可能的。在 christian grobmeier 所以这是我的
sitemesh.xml
这是我的 home.ftl 的 mainlayout.jsp 片段的片段
(使用 freemarker)
我希望这能让你继续前进,如果还不算太晚的话:D
It's possible with the version 2.4.2 of sitemesh that i'm using.Found the anwser on christian grobmeier so here is my
sitemesh.xml
here is a snippet of my mainlayout.jsp
snippet of home.ftl (using freemarker)
i hope this can get you going if it's not too late :D
NB Black Sensei 在下面发布了更好的答案。
我认为这是不可能的。 Sitemesh 是一个非常基本的模板系统,它的标签很少——总共五个。这里有一个完整的列表 装饰器 taglib
您可能想看看另一个如果您需要这种程度的控制,可以使用模板系统。
NB Black Sensei has posted a better answer below.
I don't think this is possible. Sitemesh is a pretty basic templating system that has very few tags - five in all. There's a full list here decorator taglib
You might want to look at another templating system if you need that level of control.
SiteMesh 附带 com.opensymphony.module.sitemesh.multipass.DivExtractingPageParser。它的功能有限;它只提取 body 下面一层的 div。
SiteMesh comes with com.opensymphony.module.sitemesh.multipass.DivExtractingPageParser. It's limited in functionality; it only extracts the divs one level below the body.