Hi All,
I am trying to
test the application given in HF to test <error-code> tag. But not able to figure out why this isn't working.
form.html
==========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test Error Page </TITLE>
</HEAD>
<BODY>
<form action="badPage.jsp">
<input type="submit" value="Submit" />
</form>
</BODY>
</HTML>
badPage.jsp
==============
<%@ page errorPage="errorPage.jsp" %>
<html>
<body>
Division result is::
<% int i = 10/5; %>
<%= i %>
<form action="errorPage.jsp">
<input type="submit" value="Submit" />
</form>
</body>
</html>
errorPage.jsp
===============
<%@ page isErrorPage="true" %>
<html>
<body>
Coming Inside ErrorPage.jsp
</body>
</html>
web.xml
=========
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<error-page>
<exception-type>java.lang.ArithmeticException</exception-type>
<location>/errorPage.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/errorPage.jsp</location>
</error-page>
</web-app>
This code is working fine. Control is going from badPage.jsp to errorPage.jsp.But when I am doing 10/0 in badPage.jsp it is showing page cannot be displayed.Its not displaying errorPage.jsp.
Any idea where I am doing the mistake.
Thanks,
Satya