• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp defined in error-page is not displayed

 
netto gaurav
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to run a simple scenario...I have a jsp (index.jsp) in the and i'm throwing an exception and ArithmeticException(divide b zero) using scriplet from this jsp. In the error page tag of the web.xml I have defined a page first.jsp to be displayed on an ArithmeticException. But, for some reason it ain't working. I have maked the first.jsp as an error page using isErrorPage...

Please guide as to what I could be doing wrong...


my web,.xml

index.jsp -


first.jsp


Thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in both of your jsp %> is commented .. hence you get some error. by the way: what is your error message in browser when you run
 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the functionality I have observed running against Tomcat 7:

- Use the JSP as above
- Result: 500 error - error in log
- Remove the division by zero
- Result: succeeds - no exception is thrown
- Put the division by zero back
- Result - custom error message displayed

Obviously having a page that has successfully compiled/run at some point in time makes a difference.

 
Stefan Evans
Bartender
Posts: 1784
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and to print the stack trace to your JSP page (which you look like you were trying to do), use the following

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is never appropriate to display a stack trace to the end user.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic