当前位置: 技术问答>java相关
调用 javabean 出现的错误?急
来源: 互联网 发布时间:2015-02-22
本文导语: 以下是jsp文件: 修改前: 产品 : 税率 : 修改后: 产品 : 税率 : ="TaxRate" property="Rate" /> 以下是bean文件 package taxrate; import java.sql.*; /** * Title: * Description: * Copyright: Copyright (...
以下是jsp文件:
修改前:
产品 :
税率 :
修改后:
产品 :
税率 :
="TaxRate" property="Rate" />
以下是bean文件
package taxrate;
import java.sql.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class TaxRate{
String Product;
double Rate;
public TaxRate(){
this.Product = "A001";
this.Rate = 5;}
public void setProduct (String ProductName)
{this.Product = ProductName;}
public String getProduct(){return(this.Product);}
public void setRate (double rateValue)
{
this.Rate = rateValue;
}
public double getRate()
{
return (this.Rate);
}
}
错误提示:
Error: 500
Location: /client/taxrate.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Cannot find any information on property 'Product' in a bean of type 'com.nokianeu.client.TaxRate'
at org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:619)
at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:101)
at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:730)
at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:200)
at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:169)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:183)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Unknown Source)
为什么会找不到属性呢?
修改前:
产品 :
税率 :
修改后:
产品 :
税率 :
="TaxRate" property="Rate" />
以下是bean文件
package taxrate;
import java.sql.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class TaxRate{
String Product;
double Rate;
public TaxRate(){
this.Product = "A001";
this.Rate = 5;}
public void setProduct (String ProductName)
{this.Product = ProductName;}
public String getProduct(){return(this.Product);}
public void setRate (double rateValue)
{
this.Rate = rateValue;
}
public double getRate()
{
return (this.Rate);
}
}
错误提示:
Error: 500
Location: /client/taxrate.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Cannot find any information on property 'Product' in a bean of type 'com.nokianeu.client.TaxRate'
at org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:619)
at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:101)
at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:730)
at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:200)
at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:169)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:183)
at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Unknown Source)
为什么会找不到属性呢?
|
把Product改成product,即第一个字母为小写。Rate也同样。