• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error handling in servlet  RSS feed

 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently error handling routine prints complete stack, is there a way
to show it in more friendly way that is meaningful. Certainly what is shown by Java when the error happens is a long text that looks garbage to users. I like to show only a few lines that make sense for the error from
the stack. Any ideas?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can catch exceptions and either forward or redirect the user to any error page you like.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That complete stack is the default servlet engine's output. If, like Ben says, you catch the exception in your own code, you can substitute your own handling. If the output has not already been committed, your error page can look very clean - if some output has already been sent you will get a mess.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!