jsp应用bean调用bean中的大写变量~
这是good.java的内容~package demo;
public class goods {
String Product;
double Price;
public goods(){
this.Product="box";
this.Price=5.0;
}
public String getProduct() {
return (this.Product);
}
public void setProduct(String ProductName) {
this.Product = ProductName;
}
public void setPrice(double priceValue){
this.Price=priceValue;
}
public double getPrice(){
return(this.Price);
}
}
这是index.jsp的内容:
<body>
<jsp:useBean id="goodsbean" scope="application" class="demo.goods"/>
<% goodsbean.setProduct("clock");
goodsbean.setPrice(17);
%>
使用方法1:<br>
产品:<%=goodsbean.getProduct() %> <br>
税率:<%=goodsbean.getPrice() %>
<% goodsbean.setProduct("chair");
goodsbean.setPrice(3);
%><br/>
<b>使用方法2:</b><br/>
产品:<jsp:getProperty property="product" name="goodsbean"/><br/>
税率:<jsp:getProperty property="price" name="goodsbean"/><br/>
</body>
</html>
问题来啦~~~~~~~~~~~~~、
为什么:<jsp:getProperty property="product" name="goodsbean"/><br/>中的property的值要小写啊,大写就不对啦~ --------------------编程问答-------------------- 注意这是NET板块,另外,那个需要保持一致,需要映射。 --------------------编程问答-------------------- 可考虑让斑竹帮你移到JAVA版
补充:.NET技术 , ASP.NET