`
wenson
  • 浏览: 1057164 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

sitemesh 在appfuse中的应用

阅读更多

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,此位仁兄的文章不错
分享到:
评论

相关推荐

    APPFUSE工具研究.doc

    配置环境变量,如JAVA_HOME、M2(指向Maven的bin目录)和M2_HOME,然后在PATH中添加Maven和Tomcat的bin目录,以便于执行命令和运行应用。 生成AppFuse项目时,可以通过执行特定的Maven命令来创建不同类型的项目,...

    xdoclet_appfuse打包

    适合初学者和有经验的开发者去深入理解和使用AppFuse和XDoclet,同时也涵盖了SpringSide、SiteMesh、Acegi Security(Spring Security)和Log4j等其他相关技术,对于构建和管理Java Web应用来说是一份宝贵的资源库。

    sitemesh

    SiteMesh是一个Web页面布局修饰框架, 用于构建包含大量页面, 需要一致的外观样式(look/fell), 导航和布局机制的大型网站. SiteMesh应用Decorator模式,用filter截取request和response,把页面组件head,content,...

    appfuse-documentation-2.1.0官方文档

    - **Ajax**:介绍如何在 AppFuse 应用中集成 Ajax 技术。 - **AppFuse Maven 插件**:讲解如何利用 Maven 插件来简化开发流程。 - **CSS 框架**:介绍如何在项目中使用 CSS 框架来改善界面设计。 - **数据库配置**:...

    jbpm 项目实践 1.2 (集成appfuse spring modules)

    在jbpm 1.2的实践中,我们将讨论如何集成appfuse和Spring Modules,以构建一个更强大的企业级应用。 AppFuse是一个开源项目,它提供了创建企业级Web应用程序的基础。它通过整合各种开源技术,如Spring、Hibernate、...

    Java Appfuse-源代码分析-综合文档

    【Appfuse 源代码分析】Appfuse 是一个基于 Maven 的 Java 开发框架,它集成了多种主流的 J2EE 技术,如 Spring、Struts、Hibernate、Sitemesh、Velocity、XFire 和 DWR 等。通过提供一个基础架构,Appfuse 使得...

Global site tag (gtag.js) - Google Analytics