• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Catching HTTP Error Responses

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I wasn't sure which forum this was best suited for, so my apologies if this is the wrong place. I'm trying to catch HTTP Error Responses like 404, 500, etc using the error-page element in my deployment descriptor.

For example I have this in my web.xml file:


When I enter in a url like http://localhost:8080/myapp/nonsense, where nonsense doesn't exist, I get my browser's or container's response depending on the error code instead the error.jsp page I've prepared.

How can I properly catch these?
[ June 05, 2007: Message edited by: Jenn Person ]
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Be sure that you have explicitly defined the page directive:
<%@ page isErrorPage ="true"%> in the error page.

Configuring an error page in the DD is not just enough.

Thanks,
[ June 05, 2007: Message edited by: Chandra Bhatt ]
 
Jenn Person
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chandra,

I tried adding <%@ page isErrorPage="true" %> to my error page, but it still isn't working. Is there anything else I'm missing beside this code and what I've already placed in my DD?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you just trying this in IE? If so, see what happens in other browsers. IE is notorious for subtituting its own error pages for your own.
 
Jenn Person
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point, I am actually! I'll try Firefox and see what I get. Thanks Bear.
reply
    Bookmark Topic Watch Topic
  • New Topic