Announcement Announcement Module
Collapse
No announcement yet.
How do you intercept PageNotFound warnings? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do you intercept PageNotFound warnings?

    Hi, I'd like to intercept the PageNotFound warning and send the user to a custom 404 page. How does one do that? Trapping org.springframework.web.servlet.PageNotFound doesn't seem to work.

    Also, I tried adding the following code to my web.xml
    Code:
    	<error-page>
    		<error-code>404</error-code>
    	    <location>/WEB-INF/freemarker/404.ftl</location>
    	</error-page>
    However, tomcat seems to not want to invoke this page when the wrong url is entered for non-spring urls. Help with this too please?

  • #2
    Nevermind, I fixed it for both. The solution was to change it to:
    Code:
    	<error-page>
    		<error-code>404</error-code>
    	    <location>/404.ftl</location>
    	</error-page>
    IntelliJ is reporting this as an error, but this actually works for both 404 types - spring and regular servlet errors.

    Comment

    Working...
    X