`
lihao312
  • 浏览: 482351 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

spring-boot集成sitemesh装饰器

    博客分类:
  • java
阅读更多

spring-boot-sitemesh, 依赖spring-boot-parent

项目启动访问路径 http://localhost/admin/index

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.5.RELEASE</version>
</parent>
<dependency>
    <groupId>org.sitemesh</groupId>
    <artifactId>sitemesh</artifactId>
    <version>3.0.1</version>
</dependency>
public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter{

    @Override
    protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
        builder.addDecoratorPath("/admin/*", "/admin/index")
               .addExcludedPath("/admin/index")
               .addExcludedPath("/plugin/*");
    }
}

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter{
    /**
     * 装饰器
     * @return
     * 2016年8月27日下午12:37:20
     */
    @Bean
    public FilterRegistrationBean siteMeshFilter(){
        FilterRegistrationBean fitler = new FilterRegistrationBean();
        WebSiteMeshFilter siteMeshFilter = new WebSiteMeshFilter();
        fitler.setFilter(siteMeshFilter);
        return fitler;
    }
}

 

 

application.properties

#Server
server.port=80
server.jsp-servlet.class-name=org.apache.jasper.servlet.JspServlet

security.basic.enabled=false
management.security.enabled=false

#MVC
spring.mvc.view.prefix=/WEB-INF/views/
spring.resources.static-locations=classpath:/static/

security.basic.enabled=false
management.security.enabled=false

#LOG
logging.config=classpath:log4j2.xml

 

完整项目路径

https://github.com/leelance/spring-boot-all/tree/master/spring-boot-sitemesh

分享到:
评论

相关推荐

    spring-boot-sitemesh源码整合

    spring-boot-sitemesh 源码整合

    sitemesh装饰器入门

    在实际项目中,Sitemesh 可以与其他 Web 框架(如 Struts、Spring MVC 等)很好地集成,进一步提升开发效率。对于那些需要维护大量页面的大型 Web 应用,Sitemesh 是一个非常实用的工具。通过深入理解和熟练运用 ...

    sitemesh-3.0-alpha-1 ; sitemesh-3.0-alpha-2

    SiteMesh is a web-page layout and decoration framework and web- application integration framework to aid in creating sites consisting of many pages for which a consistent look/feel, navigation and ...

    SpringMVC-Freemarker_Sitemesh3例子

    4. **配置Sitemesh3**:在`web.xml`中配置Sitemesh Filter,设置装饰器路径和排除的URL。 5. **创建Controller**:编写SpringMVC的Controller,使用注解如`@RequestMapping`来处理HTTP请求,并返回Freemarker模板的...

    Spring主流jar包大全

    sitemesh-2.4.2.jar slf4j-api-1.7.7.jar slf4j-log4j12-1.7.7.jar spring-aop-4.1.9.RELEASE.jar spring-beans-4.1.9.RELEASE.jar spring-context-4.1.9.RELEASE.jar spring-context-support-4.1.9.RELEASE.jar ...

    jsp 页面框架sitemesh 全面帮助文档及示例

    - **sitemesh.rar** 和 **sitemesh-2.4.1(1).zip**、**sitemesh-2.4.1.zip**:这些是Sitemesh的源码或者不同版本的压缩包,可能包含了示例代码和库文件,供开发者研究和学习。 5. **Sitemesh与其他框架的集成** -...

    sitemesh-2.2.1.jar sitemesh-2.2.1.jar

    **sitemesh-2.2.1.jar** 是一个用于Web应用程序界面布局的开源框架,由OpenSymphony团队开发。Sitemesh的主要功能是提供页面装饰能力,它可以帮助开发者统一网站的外观和感觉,实现页面模板和内容的分离。通过在...

    struts2-sitemesh-plugin-2.2.1.1.jarstruts2

    `struts2-sitemesh-plugin-2.2.1.1.jar`是Struts2框架与Sitemesh集成的插件,使得Struts2应用能够利用Sitemesh的功能来美化和规范化页面布局。 **Struts2框架** Struts2的核心功能包括动作映射、结果处理、数据绑定...

    sitemesh入门demo

    - 在`sitemesh-demo01`项目中,可以看到一个简单的例子,包括装饰器模板、被装饰的页面和Web应用的配置。通过运行这个示例,你可以直观地了解Sitemesh如何工作。 7. **扩展与优化** - Sitemesh支持自定义装饰策略...

    sitemesh 完美合集 4个资料和jar文件

    在WebWork中集成SiteMesh相当容易: 实际上什么也不用做. WebWork把全部值栈数据都保存在请求attribute中, 这意味着如果想显示值栈(或ActionContext)中的数据, 只需使用WebWork附带的标准标签库, 就这么简单!那来看完...

    spring mvc sitemesh velocity整合

    3. **配置Sitemesh**:在web.xml中配置Sitemesh的Filter,设置装饰器目录和排除不需装饰的URL。Sitemesh Filter会拦截请求并应用页面装饰。 4. **编写Velocity模板**:创建Velocity模板文件,定义页面的结构和动态...

    使用sitemesh替换tiles2,spring mvc+spring web flow+sitemsh

    Sitemesh,另一方面,专注于页面装饰,可以轻松地集成到现有的 MVC 框架中。它通过拦截请求并应用装饰模板来实现页面布局,从而简化了页面设计的复杂性。 下面是使用 Sitemesh 替换 Tiles2 的步骤: 1. **添加依赖...

    sitemesh教程

    - **使用sitemesh-blank.war**:也可以直接使用预打包好的`sitemesh-blank.war`文件作为起点,该文件包含了SiteMesh的基本配置。 ##### 2. 添加SiteMesh库 - 将`siteMesh-2.4.1.jar`文件拷贝到项目的`[web-app]/...

    sitemesh-2.4.1.jar

    sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar

    struts2-sitemesh-plugin-2.0.8.jar

    struts2-sitemesh-plugin-2.0.8.jar

    javaweb项目常用jar包

    struts2-sitemesh-plugin-2.0.14.jar struts2-spring-plugin-2.3.20.jar trove4j-2.0.2.jar ueditor-1.1.1.jar unoil-3.0.1.jar userSystem-1.0.jar velocity-1.5.jar xmemcached-2.0.0.jar xmemcached-...

    webwork+spring+ibatis+sitemesh开发的应用系统

    WebWork+Spring+iBatis+Sitemesh是一个经典的Java Web应用程序开发框架组合,它们各自承担着不同的职责,共同构建了一个高效、灵活且可维护的Web应用系统。下面将详细介绍这四个组件及其在开发中的作用。 1. **...

    springMVC与sitemesh的结合

    7. **Spring MVC的ModelAndView与Sitemesh**:Spring MVC的Controller返回的ModelAndView对象中的属性可以在装饰器中使用,通过`&lt;decorator:property name="yourModelAttribute"/&gt;`标签访问,实现数据在装饰器和视图...

    SiteMesh教程及SiteMesh官方文档翻译

    具体来说,将`sitemesh-2.3.jar`文件复制到`WEB-INF/lib`目录下。 **第三步:创建装饰器配置文件** 接着,需要创建一个名为`decorators.xml`的配置文件,用于定义装饰器页面。装饰器页面是指包含通用布局元素的...

    sitemesh布局知识点汇总

    - **添加依赖**:将Sitemesh的jar包(例如`sitemesh-2.1.jar`)放置到项目的lib目录下。 - **配置Web.xml**:在Web应用的部署描述文件`web.xml`中注册Sitemesh过滤器,如下所示: ```xml &lt;filter-name&gt;sitemesh...

Global site tag (gtag.js) - Google Analytics