HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /usebean.jsp(2,0) The value for the useBean class attribute usebean is invalid. org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1227) org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) org.apache.jasper.compiler.Node$Root.accept(Node.java:456) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Generator.generate(Generator.java:3272) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244) org.apache.jasper.compiler.Compiler.compile(Compiler.java:470) org.apache.jasper.compiler.Compiler.compile(Compiler.java:451) org.apache.jasper.compiler.Compiler.compile(Compiler.java:439) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
我写的JSP文件是这样地
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="test" class="usebean"/>
<jsp:setProperty name="test" property="*"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table width="200" border="1">
<tr>
<td>code</td>
<td>number</td>
<td>discount</td>
</tr>
<tr>
<td><jsp:getProperty name="test" property="code"/></td>
<td><jsp:getProperty name="test" property="number"/></td>
<td><jsp:getProperty name="test" property="discount"/></td>
</tr>
</table>
</body>
</html>
我的BEAN文件是这样地:
package Test;
public class usebean
{
private String code="123";
private int number=0;
private double discount=1.0;
//////声明得到CODE的方法
public String getCode()
{
return(code);
}
public void setCode(String code)
{
if(code!=null)
{
this.code=code;
}else
{
this.code="123";
}
}
//////声明返回NUMBER的方法
public int getNumber()
{
return(number);
}
public void setNumber(int number)
{
this.number=number;
}
///////声明得到DISCOUNT的方法
public double getDiscount()
{
return(discount);
}
public void setDiscount(double discount)
{
this.discount=discount;
}
/////声明的到编号与数量的总值的方法
public double getCodeCost()
{
double cost;
if(code.equals("AK47"))
{
cost=100.00*getNumber();
}else
{
cost=0.00;
}
return(roundToPennies(cost));
}
private double roundToPennies(double cost)
{
return(Math.floor(cost*100)/100.0);
}
public double getTotalCost()
{
return(getCodeCost()*getDiscount());
}
}
哪个大哥大姐帮小弟看看是哪里出错了>>.万分感谢>!