Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error handling in Tomcat

 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i hadle errors in tomcat. for example if tomcat could not find a file it simply displays Internal Server Error 500, what i want is it should be directed to my error page, where i can display better message.
thanx
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
if your application uses the JSP page then do the following things to display the your own message insted of the tomcat's.
1) Define your own page with any name(say ErrorDisplayer.jsp), but in the page directive make the isErrorPage= "True"
2) In this page take the error object and diplay the message with the help of methods of this object.
3) In all other remaining pages (say ErrorClient.jsp) add the page directive at the top and mention this pages relative url in the "errorPage" attribute.

Now when you will access the ErrorClient.jsp from the brower and error comes then control is transfered to the ErrorDisplayer.jsp page. Here in this page you have your own message which will get displayed on the brower insted of tomcat's message.
There is one more way also but it is very basic. There is one setting in the internet explorer to display a user friendly message. WHich will wrap ups the system error and display littile bit understandable message.
Check the upper one and let us know.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic