• 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

Exception Handling

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to define an error-page in web.xml like
<error-page>
<exception-type>MyException</exception-type>
<location>/jsp/errorpage.jsp</location>
</error-page>
In my servlet code, doGet throws a MyException (which extends ServletException).
I really thought this should go well, but a HTTP 500 - Internal Server error is created.
Is there something wrong in my approach, or what?
TIA,
Ruud.
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe you need to provide the fully qualified exception, with package:

Of course, if you're exception isn't in a package, that won't apply.
 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah, i know, but that wasn't the problem.
problem was that i was using exception.getMessage()
However, the exception is not available as it is in the jsp errorpage.
I have to retrieve the exception from the request via the request.getAttribute("javax.servlet.error.something");
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try these following links :
#1 - http://forum.java.sun.com/thread.jsp?thread=211070&forum=45&message=723737
#2 - http://www.jguru.com/faq/view.jsp?EID=1347
and if you are using Struts :
#3 - http://www.mail-archive.com/struts-user@jakarta.apache.org/msg14425.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic