当前位置: 代码迷 >> Java Web开发 >> tomcat 错误,困了几天,请大家 帮 帮助-->千里冰封转移
  详细解决方案

tomcat 错误,困了几天,请大家 帮 帮助-->千里冰封转移

热度:555   发布时间:2006-12-19 20:40:00.0
tomcat 错误,困了几天,请大家 帮 帮助-->千里冰封转移

一运行就是错误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>

搜索更多相关主题的帖子: tomcat  千里冰封  

----------------解决方案--------------------------------------------------------

<form action="" method="post">

为空?

action应该要一个页面吧


----------------解决方案--------------------------------------------------------

<form action="" method="post">

为空?

action应该要一个页面吧



----------------解决方案--------------------------------------------------------
是不是你的服务器配置有问题呢?
----------------解决方案--------------------------------------------------------
以下是引用yangte在2006-12-19 20:40:00的发言:

一运行就是错误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;
}

1.这里你只有判断是否是三角形,可是没有getTriangle()方法,所以出错
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>这三个边能构成一个三角形吗?

2.这里你的getProperty写成了getPorperty,造成错误!
<jsp:getPorperty name="triangle" property="triangle"/>
<P>面积是:
<jsp:getProperty name="triangle" property="area"/>
</form>
</body>
</html>

都是些小问题,注意些就好了


----------------解决方案--------------------------------------------------------
而且这个应该是放J2EE版块
----------------解决方案--------------------------------------------------------

很仔细,


----------------解决方案--------------------------------------------------------
你把帖子移动到J2EE那边去吧
----------------解决方案--------------------------------------------------------
  相关解决方案