一运行就是错误500 哎,时好时坏,,我真的不知道哪错了,,我搞几个都 这样,请大家帮帮偶,先谢了。
下面是代码。。。。
//javaBean
package tom.jiafei;
public class Triangle {
double sideA,sideB,sideC;
double area;
boolean triangle;
public double getArea() {
double p = (sideA+sideB+sideC)/2.0;
area = Math.sqrt(p*(p - sideA)*(p - sideB)*(p - sideC));
return area;
}
public void setArea(double area) {
this.area = area;
}
public double getSideA() {
return sideA;
}
public void setSideA(double sideA) {
this.sideA = sideA;
}
public double getSideB() {
return sideB;
}
public void setSideB(double sideB) {
this.sideB = sideB;
}
public double getSideC() {
return sideC;
}
public void setSideC(double sideC) {
this.sideC = sideC;
}
public boolean isTriangle() {
if(sideA<sideB+sideC&sideB<sideA+sideC&sideC<sideA+sideB)
triangle = true;
else triangle = false;
return triangle;
}
public void setTriangle(boolean triangle) {
this.triangle = triangle;
}
}
//jsp
<%@ page language="java" contentType="text/html; charset=gbk"
pageEncoding="gbk"%>
<%@ page import="tom.jiafei.Triangle" %>
<!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=gbk">
<title>Insert title here</title>
</head>
<body>
<form action="" method="post">
<p>输入三角形的边A:
<input type=text name="sideA" value=0>
<p>输入三角形的边B:
<input type=text name="sideB" value=0>
<p>输入三角形的边C:
<input type=text name="sideC" value=0>
<input type=submit value="提交">
<p>你给出三角形的三边是:
<jsp:useBean id="triangle" class="tom.jiafei.Triangle" scope="page">
</jsp:useBean>
<jsp:setProperty name="triangle" property="*" />
<br>边A是:
<jsp:getProperty name="triangle" property="sideA"/>
<br>边B是:
<jsp:getProperty name="triangle" property="sideB"/>
<br>边C是:
<jsp:getProperty name="triangle" property="sideC"/>
<p>这三个边能构成一个三角形吗?
<jsp:getPorperty name="triangle" property="triangle"/>
<P>面积是:
<jsp:getProperty name="triangle" property="area"/>
</form>
</body>
</html>