开发者社区> 问答> 正文

关于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?

求大神指教啊!

展开
收起
小旋风柴进 2016-03-03 10:57:55 2408 0
1 条回答
写回答
取消 提交回答
  • pservice你看看这个属性你家的对吗。这个属性的对应set get 你加的对方

    2019-07-17 18:51:05
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多