zhuoyang111 2013-12-06 13:45 采纳率: 0%
浏览 1975
已采纳

关于spring整合struts的问题

我applicationContext中的配置和action里面的内容如下:


<bean id="productService" class="com.store.serviceImpl.ProductServiceImpl">
    <property name="pdao" ref="productDao"/>
</bean
<bean name="allproductAction" class="com.store.action.AllProductAction" scope="prototype">
    <property name="pservice" ref="productService"/>
</bean>

public class AllProductAction extends ActionSupport{
private ProductService pservice;
private List product;
private int productID;
public ProductService getPservice() {
return pservice;
}
public void setPservice(ProductService pservice)
{
this.pservice = pservice;
}

 public List<Product> getCommodity() {
    return product;
}

public void setCommodity(List<Product> product) {
    this.product = product;
}
public int getproductID() {
    return productID;
}

public void setproductID(int productID) {
    this.productID = productID;
}
public String execute() throws Exception {
    product = pservice.findAll();
    return SUCCESS;
}

}
为什么我运行之后会提示一下错误:
严重: Could not open template
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'allproductAction' defined in ServletContext resource [/WEB-INF/applicationContext-actions.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'pservice' of bean class [com.store.action.AllProductAction]: Bean property 'pservice' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
求大神指教啊!

  • 写回答

1条回答

  • ludx212 2013-12-09 08:14
    关注

    pservice你看看这个属性你家的对吗。这个属性的对应set get 你加的对方

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器