|
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); } } 在网页中 产品:<jsp:getProperty name="bean" property="Product" /><br> 税率:<jsp:getProperty name="bean" property="Rate" /><p> tomcat显示 org.apache.jasper.JasperException: Cannot find any information on property 'Product' in a bean of type 'tax.TaxRate' 但如果改为小写的"product"和“rate",即 产品:<jsp:getProperty name="bean" property="roduct" /><br> 税率:<jsp:getProperty name="bean" property="rate" /><p> 则正常显示, 恳请各位帮小弟解此惑!谢谢 |
|
|
|
正常。
bean中get,set后大写, jsp中小写。 |
|
|
sorry,属性名首字母大写。
|
|
|
setProduct和getProduct确定的属性名为product
|
|
|
这个好像是javabean的规定
没有什么道理可讲的 就是不管你bean里是大写还是小写,网页中用jsp:getProperty 的时候都要小写才认 |
|
|
thanks
|
|