This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes error pages in dd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "error pages in dd" Watch "error pages in dd" New topic
Author

error pages in dd

Kathrin Sann
Greenhorn

Joined: Jun 07, 2002
Posts: 4
Hi,
I have a problem with error pages in DD.
I tried to cause an arithmetic Exception (10/0) and thought I will get my errorPage arithmeticError.jsp but always get the errorPage for Throwable: errorPage.jsp when calling badPage.jsp. What is wrong ??

badPage.jsp
<html><body>
<h1>Bad Page</h1>
<% int x=10/0; %>
</body></html>

errorPage.jsp
<%@ page isErrorPage="true" %>
<html><body>
<h1>Error !</h1>
</body></html>

arithmeticError.jsp
<%@ page isErrorPage="true" %>
<html><body>
<h1>arithmetic Error !!</h1>
</body></html>

web.xml
<error-page>
<exception-type>java.lang.ArithmeticException</exception-type>
<location>/arithmeticError.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/errorPage.jsp</location>
</error-page>

Thanks,
Kathrin
alzamabar
Ranch Hand

Joined: Jul 24, 2002
Posts: 379
Have you tried to remove the declaration for the throwable exception?


Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Kathrin Sann
Greenhorn

Joined: Jun 07, 2002
Posts: 4
Yes, then I get arithmeticError.jsp.
But I thought, the container would recognize the kind of Exception and choose the nearest ?
Kathrin
 
jQuery in Action, 2nd edition
 
subject: error pages in dd