• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot get <error-page> to work

 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I must be doing something monumentally dumb here, but I just cannot get a simple error page to work.

This is the scenario :
hello.jsp has a "divide by zero" error in it. In the web.xml, java.lang.ArithmeticException is mapped to math.html. But when I access hello.jsp, instead of math.html showing up, The browser just shows a standard Http 500 error.

hello.jsp


web.xml (relevant portion)


Browser error

The website cannot display the page
HTTP 500
Most likely causes:
•The website is under maintenance.
•The website has a programming error.


 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've pasted your code and it works fine in my case...

What's your math.html file?
Maybe try to create a new web project. Sometimes if you modify one example and test a lot of things, the web app could become messy very quickly.

Cheers!

Edit: Oh, I did forget - I tested it with tomcat 7, with Servlets 3.0 under the hood.
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pedro,

I did try creating a new web project just for this, but still the same problem. I have Tomcat 6.0 with servlet 2.5, but that should not matter right? This is pretty elementary.

Nidhi
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using IE ? If yes, go the Internet Options, and turn off the friendly error messages in the Advanced tab. (see this)
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Are you using IE ? If yes, go the Internet Options, and turn off the friendly error messages in the Advanced tab. (see this)


Yessss. It worked! Thanks Christophe. Hmmm, interesting to remember that while designing a web application, we cannot depend on this behaviour, since the client might have that option checked.
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't use IE in last 5 years, but it's definitely good to know about that!

Thanks Christophe!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic