Hi,
The simple example to capture a form value and display my error page under Tomcat 5.0 doesn't work. I have an errorhandler.jsp which looks like this -
-------------
<%@ page errorPage="errorpage.jsp" %>
<html>
<body>
<form method=post action="errorhandler.jsp">
What's the coolest programming language in the known universe ?<p>
Java<input type=radio name=language value="JAVA" checked>
C++<input type=radio name=language value="CPP">
Visual Basic<input type=radio name=language value="VB">
<p>
<input type=submit>
</form>
<%
if (request.getMethod().equals("POST")) {
if (request.getParameter("language").equals("JAVA")) {
out.println("<hr><font color=red>You got that right!</font>");
}
else {
throw new Exception("You chose the wrong language!");
}
}
%>
</body>
</html>
------------------
And an errorpage.jsp which looks like this -
--------------
<%@ page isErrorPage="true" %>
<html>
<body>
<h1>
Error Page
</h1>
<hr>
<h2>
Received the exception:<br>
<font color=red>
<%= exception.toString() %>
</font>
</h2>
</body>
</html>
-----------------------------------
The errorhandler.jsp is displayed alright and when the errorpage is expected, i get the HTTP 500 Internal server error page.
The simple example to capture a form value and display my error page under Tomcat 5.0 doesn't work. I have an errorhandler.jsp which looks like this -
-------------
<%@ page errorPage="errorpage.jsp" %>
<html>
<body>
<form method=post action="errorhandler.jsp">
What's the coolest programming language in the known universe ?<p>
Java<input type=radio name=language value="JAVA" checked>
C++<input type=radio name=language value="CPP">
Visual Basic<input type=radio name=language value="VB">
<p>
<input type=submit>
</form>
<%
if (request.getMethod().equals("POST")) {
if (request.getParameter("language").equals("JAVA")) {
out.println("<hr><font color=red>You got that right!</font>");
}
else {
throw new Exception("You chose the wrong language!");
}
}
%>
</body>
</html>
------------------
And an errorpage.jsp which looks like this -
--------------
<%@ page isErrorPage="true" %>
<html>
<body>
<h1>
Error Page
</h1>
<hr>
<h2>
Received the exception:<br>
<font color=red>
<%= exception.toString() %>
</font>
</h2>
</body>
</html>
-----------------------------------
The errorhandler.jsp is displayed alright and when the errorpage is expected, i get the HTTP 500 Internal server error page.