为了账号安全,请及时绑定邮箱和手机立即绑定

http://localhost:8080/Design/addProduct.jsp 页面报500

<!-- 配置Action -->

<bean id="productAction" class="com.zw.action.ProductAction" scope="prototype">

<!-- 手动注入 -->

<property name="productService" ref="productService"></property>

</bean>

<!-- 配置业务层 -->

<bean id="productService" class="com.zw.service.ProductService">

<property name="ProductDao" ref="ProductDao"></property>

</bean>

<!-- 配置Dao层 -->

<bean id="ProductDao" class="com.zw.dao.ProductDao"></bean>

==========================================================

<action name="Product_*" class="productAction" method="{1}">

</action>

==========================================================

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productAction' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'productService' of bean class [com.zw.action.ProductAction]: Bean property 'productService' is not writable or has an invalid setter method. Did you mean 'productservice'?

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1529)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1237)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:552)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)

at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)

at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:244)

at org.apache.struts2.components.ServletUrlRenderer.renderFormUrl(ServletUrlRenderer.java:179)

at org.apache.struts2.components.Form.populateComponentHtmlId(Form.java:231)

at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:819)

at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:55)

at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)

at org.apache.jsp.addProduct_jsp._jspx_meth_s_005fform_005f0(addProduct_jsp.java:114)

at org.apache.jsp.addProduct_jsp._jspService(addProduct_jsp.java:81)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Thread.java:619)

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'productService' of bean class [com.zw.action.ProductAction]: Bean property 'productService' is not writable or has an invalid setter method. Did you mean 'productservice'?

at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243)

at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:423)

at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280)

at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)

at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1525)

... 35 more


正在回答

3 回答

解决了吗,同错误

0 回复 有任何疑惑可以回复我~

你的productAction里面声明的productService这个变量,注意看大小写是不是跟xml里面配置的id相同

0 回复 有任何疑惑可以回复我~

JDK用的什么版本,输入的时候价格输入的是否是数字

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

http://localhost:8080/Design/addProduct.jsp 页面报500

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信