File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Custom error pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Custom error pages" Watch "Custom error pages" New topic

Custom error pages

Aaron John
Ranch Hand

Joined: May 30, 2005
Posts: 74
Not sure if this is the right place to post this. I would like to display a custom error page for a web app. The error page has to display all exceptions thrown by our app, as well as Velocity. Does anyone have any experience in this? Is there something I can configure in Velocity in order to achieve this? Thanks.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

I'm not sure if there is a velocity specific way to do this but the servlet spec provides a mechanism by which you can define custom error pages from within your deployment descriptor (web.xml)

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Aaron John
Ranch Hand

Joined: May 30, 2005
Posts: 74
Thanks for reply. Yes I know of this method. However, I'm not sure why exceptions from Velocity do not get handled even with those entries in web.xml. Anyone have any ideas?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I don't know Velocity, but maybe you could try with <error-type> instead of <error-code>

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Custom error pages
It's not a secret anymore!