以前有帖子专门提过这个问题啊,里面都是高手,请闲下来好好参考!!
http://expert.csdn.net/Expert/topic/2505/2505496.xml?temp=.5114099您的这个问题出在变量名和方法名的规范上,把所有的
categoryID改成categoryid, 方法名set/get + 变量名(首字母从小写转换为大写)
getCate()改成getCategoryid(),set一样,少改一样都不行另外getCate(String categoryID)中的String categoryID可以取掉--------------------------------------------------------------------包代码:
package store;public class ProductBean{
private String categoryid;public void setCategoryid(String aaa) {
this.categoryid = aaa;
}
public String getCategoryid() {
try {
return categoryid;
}
catch (Exception ex) {
return "productBean.getCategoryid() error";
}
}}
页面代码:
<jsp:useBean id="productBean" class="store.ProductBean" /> <jsp:setProperty name="productBean" property="categoryid" value="aaa" />
<jsp:getProperty name="productBean" property="categoryid" />其中的value="aaa"是我测试用的
http://expert.csdn.net/Expert/topic/2505/2505496.xml?temp=.5114099您的这个问题出在变量名和方法名的规范上,把所有的
categoryID改成categoryid, 方法名set/get + 变量名(首字母从小写转换为大写)
getCate()改成getCategoryid(),set一样,少改一样都不行另外getCate(String categoryID)中的String categoryID可以取掉--------------------------------------------------------------------包代码:
package store;public class ProductBean{
private String categoryid;public void setCategoryid(String aaa) {
this.categoryid = aaa;
}
public String getCategoryid() {
try {
return categoryid;
}
catch (Exception ex) {
return "productBean.getCategoryid() error";
}
}}
页面代码:
<jsp:useBean id="productBean" class="store.ProductBean" /> <jsp:setProperty name="productBean" property="categoryid" value="aaa" />
<jsp:getProperty name="productBean" property="categoryid" />其中的value="aaa"是我测试用的
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货