Spring configuration class (also provided in the attached sample project):
@Configuration
public class WebConfiguration extends WebMvcConfigurerAdapter {
@Bean
public InternalResourceViewResolver setupViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/jsp/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
@Bean
public FilterRegistrationBean siteMeshFilter() {
FilterRegistrationBean filter = new FilterRegistrationBean();
Filter siteMeshFilter = new SiteMeshFilterBuilder()
.addDecoratorPath("/*", "/WEB-INF/jsp/decorator.jsp")
.setIncludeErrorPages(true)
.create();
filter.setFilter(siteMeshFilter);
filter.setUrlPatterns(Arrays.asList("/*"));
// filter.setDispatcherTypes(ERROR); // with this error page is decorated but not other pages
// filter.setDispatcherTypes(REQUEST, FORWARD, ERROR); // this doesn't work either
return filter;
}
}
Default JSP error page is not decorated by SiteMesh 3 in Spring Boot app despite
includeErrorPages
being set totrue
.Steps to reproduce
./gradlew bootRun
http://localhost:8080/non-existent
andhttp://localhost:8080/foo
http://localhost:8080/
the pages are not decorated asDecorated by Sitemesh
string is not displayedSample project
Full project: sitemesh-issue.zip
Spring configuration class (also provided in the attached sample project):