appfuse的页面是通过sitemesh模板做的。在web.xml里的相关配置:
< filter >
< filter - name > sitemesh </ filter - name >
< filter - class > com.opensymphony.module.sitemesh.filter.PageFilter </ filter - class >
</ filter >
< filter - mapping >
< filter - name > sitemesh </ filter - name >
< url - pattern > /**/ /* </url-pattern>
<!--dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher-->
</filter-mapping>
然后它自己有一个配置文件。sitemesh.xml内容如下:
< sitemesh >
< property name = " decorators-file " value = " /WEB-INF/decorators.xml " />
< excludes file = " ${decorators-file} " />
< page - parsers >
< parser default = " true " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
< parser content - type = " text/html " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
< parser content - type = " text/html;charset=ISO-8859-1 " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
</ page - parsers >
< decorator - mappers >
< mapper class = " com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper " >
< param name = " config " value = " ${decorators-file} " />
</ mapper >
</ decorator - mappers >
</ sitemesh >
还有一个配置文件,decorators.xml,内容如下:
< decorators defaultdir = " /decorators " >
< excludes >
< pattern >/ demos /**/ /* </pattern>
<pattern>/resources/*</pattern>
</excludes>
<decorator name="default" page="default.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
表示不装饰 /demos 和 /resources下的页面。装饰器的模板为default.jsp。而且此模板网页在文件夹/decorators下。 然后打开 default.jsp.我们会看到有以下几个标签:
1 : <decorator:title/> :
导入要装饰的原始页面的title内容 然后是一些导入css和javascript的代码。
2 : <decorator:head />
导入原始页面(被包装页面)的head标签中的内容。
3 : <decorator:getProperty property="body.id" writeEntireProperty="true"/>
在标签处插入原始页面(被包装页面)的原有的标签的属性中的内容
本文摘自http://www.blogjava.net/liuwentao253/archive/2007/02/01/97325.html,此位仁兄的文章不错
< filter >
< filter - name > sitemesh </ filter - name >
< filter - class > com.opensymphony.module.sitemesh.filter.PageFilter </ filter - class >
</ filter >
< filter - mapping >
< filter - name > sitemesh </ filter - name >
< url - pattern > /**/ /* </url-pattern>
<!--dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher-->
</filter-mapping>
然后它自己有一个配置文件。sitemesh.xml内容如下:
< sitemesh >
< property name = " decorators-file " value = " /WEB-INF/decorators.xml " />
< excludes file = " ${decorators-file} " />
< page - parsers >
< parser default = " true " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
< parser content - type = " text/html " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
< parser content - type = " text/html;charset=ISO-8859-1 " class = " com.opensymphony.module.sitemesh.parser.HTMLPageParser " />
</ page - parsers >
< decorator - mappers >
< mapper class = " com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper " >
< param name = " config " value = " ${decorators-file} " />
</ mapper >
</ decorator - mappers >
</ sitemesh >
还有一个配置文件,decorators.xml,内容如下:
< decorators defaultdir = " /decorators " >
< excludes >
< pattern >/ demos /**/ /* </pattern>
<pattern>/resources/*</pattern>
</excludes>
<decorator name="default" page="default.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
表示不装饰 /demos 和 /resources下的页面。装饰器的模板为default.jsp。而且此模板网页在文件夹/decorators下。 然后打开 default.jsp.我们会看到有以下几个标签:
1 : <decorator:title/> :
导入要装饰的原始页面的title内容 然后是一些导入css和javascript的代码。
2 : <decorator:head />
导入原始页面(被包装页面)的head标签中的内容。
3 : <decorator:getProperty property="body.id" writeEntireProperty="true"/>
在标签处插入原始页面(被包装页面)的原有的标签的属性中的内容
本文摘自http://www.blogjava.net/liuwentao253/archive/2007/02/01/97325.html,此位仁兄的文章不错