• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom Error Page

 
Sangeetha Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Iam aware that u have to include the page directive in the page where the error is generated so that it is forwarded to a jsp error page which has the directive "isErrorPage="true"...but doesnt seem to be working...
my html is in "c:\tomcat\webapps\app-name\subfolder" with the page directive before the <html> tag.
<%@ page errorPage="/subfolder/show_error_page.jsp" %>
my error page is in the same folder too named "show_error_page.jsp" with the foll code
<html>
<body>
<%@ isErrorPage = "true" %>
this is a custom error page
<p><i> <%= exception %> </i>
<body>
</html>
iam not sure where the mistake is...Greatly appreciate the help
 
Sangeetha Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also read in one of the prevs messages that the page directive in the html page should be above the html tag...i tried it as the first line in body and before html too...confused as to what is right
<%@ page errorPage="show_error_page.jsp" %>
before html tag or first line of body tag???
sorry for the 2nd post
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sangeetha,
can you please tell, which exception gets generated in your main jsp page? Also if the control doesn't go to error page (when exception is generated), what is displayed? and lastly are you using try-catch in your main jsp?
 
Sangeetha Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prakash,
actually iam the one inducing the error for testing purposes...iam not using try catch..iam just trying to write to a file and so for testing i made it read only....so that an exception is created and i can see my custom error page..its status 500 error
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.io.FileNotFoundException: C:\Tomcat 5.0\webapps\murach\WEB-INF\etc\UserEmail.txt (Access is denied)
hope this helps
 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your error is in your error page tag.
You have:
<%@ isErrorPage = "true" %>
I think it should be
<%@ page isErrorPage = "true" %>
(You forgot the "page" in the tag on the error page)
 
Sangeetha Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks mike, i tried it out but same result...am i making a mistake in the path while calling for the error jsp file?....plz refer to my first post...
thanks again
 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was playing around with this earlier today, so some of the problems are fresh in my mind.
First, make sure your current page works. Remove your errors and make sure there aren't other errors masking your error. Then put in your error--and make it simple, maybe an SQL error or something like that. For the error page reference, try both relative and absolute paths.
Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic