我正在使用
struts2-archetype-starter
Maven 模板来创建 Struts2 Web 应用程序。虽然我以前使用过 Struts2,但我对 Sitemesh 还很陌生。我的 adminTemplate.jsp
文件夹中有一个 decorator
,其中包含一个 <decorator:body />
标签。
众所周知,正文并不是我们唯一想要自定义的东西,我的页面中需要一些自定义的scripts。
<decorator:body />
位于页脚上方(不太适合放置脚本)。
我还尝试参考 Sitemesh 提供的文档,这里:
http://wiki.sitemesh.org/display/sitemesh/Passing+Additional+Elements+to+the+Decorator
但是,不幸的是,该页面根本没有任何文字。
我怎样才能达到同样的效果?我也在寻找一些好的文档。
您可以在 adminTemplate.jsp 中插入 head 占位符
<head>
<title>
<decorator:title/>
</title>
...
...
<decorator:head/>
</head>
然后在您的页面中自定义脚本。
<head>
<title>
page1
</title>
<script>
....
</script>
</head>