错误检测页面,老是不成功
以下三篇程序都在我怀疑是语法错误,不是我配置问题。
文件名称:check.jsp
<%@ page language="java" contentType="text/html; charset=GBK" errorPage="error.jsp" %>
<html><head>
<title>错误异常检测页面</title>
</head>
<body>
<center>
<br><h1>
<%
int checki=0;
int checkor=0;
int result=0;
try{
checki=Integer.parseInt(request.getParameter("value1"));
}
catch(NumberFormatException nfex){
throw new NumberFormatException("被除数不是整数!");
}
try{
checkor=Integer.parseInt(request.getParameter("value2"));
}
catch(NumberFormatException nfex){
throw new NumberFormatException("除数不是整数!");
}
result=checki/checkor;
out.println("<h3>正确运算结果:<hr></h3>");
out.println(checki+"/"+checkor+"="+result);
%>
</h1>
<a href="javascript:history.back();">返回</a>
</center>
</body>
</html>
文件名称:error.jsp
<%@page language="java" isErrorPage="true" contentType="text/html;charset=GB2312" %>
<html>
<head>
<title>错误处理页面</title>
</head>
<body bgcolor="#ffffff">
<div aglin="center">
<br>
<h1>错误信息<h1>
<hr>
<p><center>
<h3><%=exception.toString()%></h3>
<a href="javascript:history.back();">返回</a>
</center>
</p>
</div>
</body>
</html>
文件名称: compute.htm
<html>
<head>
<title>除法运算--JSP中处理异常</title>
</head>
<body bgcolor="#ffffff">
<div align="center">
<form action="check.jsp" method="post" target="_self">
———— 整 数 除 法 运 算 ————<br>
<p>被除数:<input type="text" name="value1">
除数:<input type="text" name="value2">
</P>
<p>
<input type="submit" name="submit" value="计算">
</p>
</form>
</div>
</body>
</html>