• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error handling in MVC  RSS feed

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anybody please provide me some information that how to handle errors in a website.

I am working on a websiet and using MVC. I want to catch all rendering time, business time and database related
errors and show a user friendly message to user and want to log the actual exception for developers

What is the best way to achive this.

Do i need to use ErrorPages.jsp kind of this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet is to let all exceptions propagate outward to the container. You may need to wrap them in ServletException along the way.

In your web.xml, define an error handling servlet that logs the error for diagnostic use and then forwards to a user-facing, friendly JSP page.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!