compute.html
--------------------------------------------------------------------------------------------------------------- --
<title>Compute</title>
<body bgcolor= "#FFFFFF" >
<div align= "center" >
<form method= "POST" action= "divide.jsp" >
<p>---integer Division---
<p> Dividend
<input type= "text" name= "value1" >
Divisor
<input type= "text" name= "value2" >
</p>
<p>
<input type= "Submit" name= "submit" value= "calculation" >
</p>
</form>
</div>
</body>
--------------------------------------------------------------------------------------------------------------- --
divide.jsp
--------------------------------------------------------------------------------------------------------------- --
<%@ page language= "java" errorpage= "error.jsp"
Contenttype= "TEXT/HTML;CHARSET=GBK"%>
<title>Divide</title>
<body bgcolor= "#FFFFFF" >
<center>
<br>
<%
int dividend = 0;
int divisor = 0;
int result = 0;
try {
Dividend = Integer.parseint (Request.getparameter ("value1"));
catch (NumberFormatException nfex) {
throw new NumberFormatException ("Dividend is not an integer!");
}
try {
divisor = Integer.parseint (Request.getparameter ("value2"));
catch (NumberFormatException nfex) {
throw new NumberFormatException ("Divisor is not an integer!");
}
result = Dividend/divisor;
OUT.PRINTLN (Dividend + "/" + divisor + "=" + result);
%>
<br>
<br>
<br>
<a href= "Javascript:history.back ();" > Return </a>
</center>
</body>
--------------------------------------------------------------------------------------------------------------- --
error.jsp
--------------------------------------------------------------------------------------------------------------- --
<%@ page language= "java" iserrorpage= "true" contenttype= "TEXT/HTML;CHARSET=GBK"%>
<title>compute error</title>
<body bgcolor= "#FFFFFF" >
<div align= "center" >
<br><br>
<p>
<br><br><br>
<a href= "Javascript:history.back ();" > Return </a>
</p>
</div>
</body>
--------------------------------------------------------------------------------------------------------------- --
The final run results show:
When the input numbers can get the correct results
when you enter a different character, it appears as follows:
--------------------------------------------------------------------------------------------------------------- --
--------------------------------------------------------------------------------------------------------------- --
Solution Method:
This is the problem of IE itself, in
Internet Options-Advanced--"Browse"--"show friendly HTTP" information (nineth)
--------------------------------------------------------------------------------------------------------------- --