Question

Is there way to mount a 404 error page in Wicket-1.5.x without adding:

<error-page> 
  <error-code>404</error-code>
  <location>/NotFound</location>
</error-page>

to my web.xml file?

I have several applications that all use the same/similar Look/Feel. I've extracted out a lot of the common functionality including my error pages to some shared jar files. I'm already mounting a lot of common pages (Login Pages, Error Pages, etc) via an Iinitializer. Is there a way I can do the same for 404 errors?

UPDATE:

In Doing more research I also found this question:
Can I redirect to a valid Wicket page when attempting to access a non-existent page?
Which also seems to state that editing web.xml is the solution.

As I said I have several applications while editing the file isn't hard and there isn't that many, it's one more thing I'll have to remember next time I upgrade them.

If it makes a difference I'm using Tomcat-6.x Is there possibly a way to fake the <error-page> configuration setting in my web.xml by modifying ServletContext?

Was it helpful?

Solution

As far as I know you need those lines in your web.xml, but once you've done that you can still mount your common page along with everything else in your IInitializer:

application.mount(
        new QueryStringUrlCodingStrategy("NotFound", NotFoundErrorPage.class));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top