I'm trying to do the same thing as the guy in this thread: How do I have common error page templates with tiles in a Spring/MVC 3.0 app?
However, following that question's accepted solution does not seem to provide the same results for my 404 errors. This exact same setup DOES work for 500 errors however! I have the following code:
tiles.xml:
<definition name="error/404" extends="baseLayout">
<put-attribute name="body" value="/WEB-INF/jsp/error/404.jsp" />
</definition>
/WEB-INF/jsp/error/404.jsp:
Error 404: This page doesn't exist, use the navigation on the left to find what you need
/WEB-INF/jsp/error/fullErrorPage/404.jsp:
<!-- this page is used by the web.xml to display an error VIEW, not just the error -->
<%@page isELIgnored="false" %>
<%@page contentType="text/html"%>
<%@taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<!-- insert the view -->
<tiles:insertDefinition name="error/404" />
web.xml:
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/jsp/error/fullErrorPage/404.jsp</location>
</error-page>
I think the problem is that when I navigate to a URL I know doesn't exist in order to trigger a 404 error, the 'error/404' view is not available. All the linking works fine, since if I change the 'fullErrorPage/404.jsp' to a generic error page and remove the 'tiles:insertDefinition' the page is rendered properly. However, whenever I try to use the 'tiles:insertDefinition' I just get a generic 404 error page instead.
The tomcat log files also seem to indicate there is some kind of infinite loop going on since I'm assuming each time it tries to render the 'fullErrorPage/404.jsp' with the 'tiles:insertDefinition' it generates a 404 error and then tries to render the 'fullErrorPage/404.jsp' once again.