请各位高手指点一下呀,一个简单的程序,总是报错误HTTP Status 500 -
javabean程序如下:
package tax;
public class TaxRate {
double Rate;
public TaxRate(){
this.Rate = 5;
}
public void setRate(double rateValue){
this.Rate=rateValue;
}
public double getRate() {
return(this.Rate);
}
}
JSP程序如下:
<html>
<body>
<%@ page language="java" pageEncoding="GBK"%>
<%@ page extends="tax.TaxRate" %>
<jsp:useBean id="taxbean" scope="application" class="tax.TaxRate" />
<%
taxbean.setRate(17);
%>
使用方法1:<p>
税率:<%= taxbean.getRate() %>
</p>
<%
taxbean.setRate(3);
%>
<b>使用方法2:</b>
税率:<jsp:getProperty name="taxbean" property="Rate" />
</body>
</html>
错误如下:
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: Cannot find any information on property 'Rate' in a bean of type 'tax.TaxRate'
org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:839)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1054)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1124)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3383)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.
请各位高手指点一下呀,感谢感谢感谢~~~~~
------解决方案--------------------tax.TaxRate没有导入
<%@ page import="tax.TaxRate" %>
------解决方案--------------------同楼上
------解决方案--------------------你在taxbean.setRate(17);之前先把它new出来啊
------解决方案--------------------你的构造函数的问题,写上参数!
------解决方案-------------------- HTML code
税率:<jsp:getProperty name="taxbean" property="Rate" />
------解决方案--------------------
问题已解决。
javabean程序如下:
package tax;
public class TaxRate {
private double rate;