Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error pages in web.xml

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all:
I am trying to add error handling in my web.xml file.
here is the code:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/errorPage.jsp</location>
</error-page>
It is not working correctly. It catchs Exceptions, but not RuntimeExceptions.
I had to add another code:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/errorPage.jsp</location>
</error-page>
RuntimeExeption exteds Exception. Shouldn't be cought without adding the second code.
thanks
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RuntimeException, or a class derived from it, is different from other subclasses of Exception in that it is an UncheckedException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic