Using a servlet filter for 404 error-page

The upcoming Wicket 1.3 and 2.0 versions intercept their requests using a servlet filter to provide more flexible resource mapping and nicer URLs. Your Wicket pages no longer need to live at and can instead be rooted properly at

This is now working well. I did, however, come up against a small issue, which is how you serve custom error pages for your 404 or 500 responses. It’s nice to render these like any other pages, so you can use your branding and whatnot. This used to work fine with Wicket as a servlet, but switching to a filter broke things. I did some digging around before reading the servlet spec in more detail and finally realising you need a Servlet 2.4 spec container and web.xml config file, with some <dispatcher> elements in your filter mapping.

The following does the trick:

<web-app xmlns=""

6 thoughts on “Using a servlet filter for 404 error-page”