sitemesh3 not decorating error pages #25

atomi opened this Issue Mar 30, 2011 · 5 comments


None yet
4 participants

atomi commented Mar 30, 2011

if you set an error-page element in web.xml sitemesh3 won't decorate that file.

ERROR in the filter-mapping does nothing.
Hopefully someone can confirm this as well - just in case I might have missed something.

atomi commented Apr 12, 2011

Just wanted to follow up on this issue.
The following is working for me.


My earlier problem with errors not being decorated was just a user error (If dispatcher>REQUEST is added it will not work).

atomi closed this Apr 12, 2011

pasemes commented Aug 7, 2014

atomi definition worked for me...

m4wayne commented Jul 16, 2015


flopma commented Apr 25, 2017


I cannot confirm this work. Actually, the ERROR dispatcher is needed because in my case Tomcat 8.0.43 will handle error page with a ERROR dispatcher (for error pages defined in the web.xml).

But when we arrive into org.sitemesh.webapp.contentfilter.BasicSelector.filterAlreadyAppliedForRequest(HttpServletRequest) from org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ServletRequest, ServletResponse, FilterChain), the method will return true because the request has already been through the SiteMesh filter. This will make SiteMesh filter to skip decoration of the error page.

So I don't get how this can work. For the me bug is still there.

Can someone confirm or invalidate?


flopma commented Apr 26, 2017

I had to create a new selector extending the BasicSelector and override this method so SiteMesh would work nicely with Spring Security and Spring MVC since I did not put Sitemesh as the first Filter, I prefer Spring Security filters to be the 1st.

    protected boolean filterAlreadyAppliedForRequest(HttpServletRequest request) {
      if (request.getDispatcherType().equals(DispatcherType.ERROR)) {
        LOG.debug("Currently in a ERROR dispatcher - preventing SiteMesh from skipping decoration");
        return false;

      return super.filterAlreadyAppliedForRequest(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment