<%@page contentType= "text/html " %>
<%@page pageEncoding= "UTF-8 "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "
"http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 ">
<title> Triangle </title>
</head>
<body>
<form>
<p> 第一条边: <input type= "text " name= "side0 ">
<p> 第二条边: <input type= "text " name= "side1 ">
<p> 第三条边: <input type= "text " name= "side2 ">
<input type= "submit " name= "submit ">
<% String s0=request.getParameter( "side0 ");
String s1=request.getParameter( "side1 ");
String s2=request.getParameter( "side2 ");
if(s0==null)s0= "1 ";
if(s1==null)s1= "1 ";
if(s2==null)s2= "1 ";
try{
Int a=Integer.parseInt(s0);
Int b=Integer.parseInt(s1);
Int c=Integer.parseInt(s2);
double d=(double)((a+b+c)/2);
double result=Math.sqrt(d*(d-a)*(d-b)*(d-c));
}
catch(NumberFormatException e){
out.print( "qing ");}
out.print(result);
%>
</form>
</body>
</html>
上面是我写的一个求三角形面积的jsp,有错误不知道怎么改。。。。。。。。。
------解决方案--------------------