boolean isProductInPromotion = false;
其的get、set方法如下
public boolean isProductInPromotion() {
return isProductInPromotion;
}
public void setProductInPromotion(boolean isProductInPromotion) {
this.isProductInPromotion = isProductInPromotion;
}
这里的isProductInPromotion变量名最好不要添加is前缀,改成productInPromotion。否则在前端Js中引用isProductInPromotion变量时始终是undefined,经发现,传到前端的变量值名字是productInPromotion,而不是isProductInPromotion。
另外再转换成json数据是也会出现同样的问题
"productInPromotion":false,
修改如下更好
boolean productInPromotion = false;
其的get、set方法如下
public boolean isProductInPromotion() {
return productInPromotion;
}
public void setProductInPromotion(boolean productInPromotion) {
this.productInPromotion = productInPromotion;
}