以后要写注释
还有 不要忘记{}
尤其是if for 等等 记住了 别老是犯错误
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>My JSP 'hello6.jsp' starting page</title>
</head>
<body>
<form action="" method="get" name=form>
<br>
qing shuru
<input type="text" name="a">
<br>
qing shuru
<input type="text" name="b">
<br>
qing shuru
<input type="text" name="c">
<br>
<input type="submit" name="submit" value="send">
</form>
<%
String string_a = request.getParameter("a"), string_b = request
.getParameter("b"), string_c = request.getParameter("c");
double a = 0, b = 0, c = 0;
%>
<%
if (string_a == null) {
string_a = "0";
string_b = "0";
string_c = "0";
%>
<%
}
try {
a = Double.valueOf(string_a).doubleValue();
b = Double.valueOf(string_b).doubleValue();
c = Double.valueOf(string_c).doubleValue();
if (a + b > c && b + c > a && c + a > b) {
double p = (a + b + c) / 2.0;
double mianji = Math.sqrt(p * (p - a) * (p - b) * (p - c));
out.print(mianji);
} else{
out.print("nishurudebushisanjiaoxing");
}
} catch (NumberFormatException e) {
out.print("qingshuruzifu");
}
%>
</body>
</html>