• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using a custom error page  RSS feed

 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to get my JSP page to use a custom error page but i'm not having very much luck. I have created the error page called show_error_page.jsp and included the line

However then I have my problem - how do I actually use this error page? I have included in my JSP page the line

but it doesn't seem to be working. Where abouts in the jsp page should the above line go? At the moment I have it at the top of the body.
Also how do you get a custom error to show when say a file is missing or the server is down?
Thanks
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have a comma instead of dot in the filename, which may be the problem.
 
Eelco den Heijer
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in your deployment descriptor web.xml, register your error page as being the error page for certain errors. You can register errors with a certain HTTP error code, or exception types with your error page.
If you have done this, create a test page in which you throw an exception. This will result in HTTP error code 500, and a ServletException; if you have registered either the 500 code, or the ServletException with your page, your page will be shown. You should NOT register the error page explicitly in the calling page.
 
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
You should NOT register the error page explicitly in the calling page.

Why not?
bear
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!