首先要感谢发明Markdown的家伙,这东西真是好用吖!
###SiteMesh概述 嗯,请自行之。
###教程:一分钟完成Template模板组合
####1.内容页面 简单的示例内容页面源代码如下:
应该是内容页面 Weekdays
5:00pm - 10:00pm
Weekends
5:00pm - 10:00pm
down
在源代码中加入 <meta name="theme" content="basic_theme" />
即可由SiteMesh自动完成Template模板装配。
####2.Runtime环境配置
-
WEB-INF目录下添加 sitemesh.xml,文件内容中除了指定 decoration-file 路径的属性需定制外,其他内容基本不需更改。
-
WEB-INF/lib 目录下加入 sitemesh-2.4.2.jar
这个可以自己在github上获取最新版本,话说 sitemesh 3.0 好像无疾而终了?
-
WEB-INF/web.xml 文件中加入。重点是
<url-pattern>*.jsp</url-pattern>
,为了防止SiteMesh随意处理各类图片、Javascript或StyleSheets资源,最好指定后缀或url路径。sitemesh com.opensymphony.sitemesh.webapp.SiteMeshFilter sitemesh *.jsp FORWARD REQUEST -
最后也是最重要的 decorators.xml文件
这里的
<decorator name="basic_theme" .../>
,对应你的内容文件中的<meta name="theme" content="basic_theme" />
额外说明的是:这里使用Page模型组合Template模板,因为最简单!
...