之前项目使用的是sitemesh2.4.2 搞的走了好多弯路 好了开场白就不说了
1. 依赖
<dependency>
<groupId>org.sitemesh</groupId>
<artifactId>sitemesh</artifactId>
<version>3.0.1</version>
</dependency>
2. 建立以下4个类
package com.dance.admin.sitemesh;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfigure implements WebMvcConfigurer {
@Bean
public FilterRegistrationBean siteMeshFilter() {
FilterRegistrationBean fitler = new FilterRegistrationBean();
fitler.setFilter(new Meshsite3Filter());
return fitler;
}
}
package com.dance.admin.sitemesh;
import org.si