struts-config.xml中配置action <action path="/testAction" type="org.springframework.web.struts.DelegatingActionProxy" name="testForm" scope="request" parameter="action" validate="true">
<forward name="search" path="/testAction.do?action=query" contextRelative="true"/>
</action>
spring的配置文件中
<bean id="testDao" class="com.test.dao.TestDAO" />
<bean id="testService" parent="baseService"
class="com.test.service.TestService">
<property name="testDao">
<ref bean="testDao" />
</property>
</bean>
<bean name="/testAction"
class="com.test.action.TestAction">
<property name="testService">
<ref bean="testService"/>
</property>
</bean>
<forward name="search" path="/testAction.do?action=query" contextRelative="true"/>
</action>
spring的配置文件中
<bean id="testDao" class="com.test.dao.TestDAO" />
<bean id="testService" parent="baseService"
class="com.test.service.TestService">
<property name="testDao">
<ref bean="testDao" />
</property>
</bean>
<bean name="/testAction"
class="com.test.action.TestAction">
<property name="testService">
<ref bean="testService"/>
</property>
</bean>
解决方案 »
- 什么OpenSource软件可以import a javaProject,自动给出a Class/Relation diagram?
- 用SSH如何实现上传,下载?
- 将struts转换成portal的问题
- EJB问题,在线等
- winxp+tomcat5.027+sqlserver 2000问题
- 有没有谁用过axis和一些包等工具对soap消息进行加密过
- 使用LookupDispatchAction的表单按钮不能为中文的问题
- 小的初到宝坻,给各位请安了。顺便请教个比较菜的问题。
- jtable 设置它不好移动列的相对位置
- 关于rmi 启动服务器 异常--java.net.ConnectException: Connection refused: connect
- spring中如何根据时间调用方法
- java调用C++的dll,用jnative出错!!急!!!
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>=========================这是applicationContext.xml配置文件中的一段
<bean name="/add"
class="com.wootion.struts.action.AddAction" >
<property name="sshservice">
<ref bean="sshservice" />
</property>
</bean>=========================这是action-context.xml配置文件中的一段
<bean id="sshservice" parent="SshDAOProxy">
<property name="target">
<bean
class="com.wootion.services.impl.SshservicesImpl">
<property name="daoTool">
<ref bean="daoTool" />
</property>
</bean>
</property>
</bean>=========================这是bo-context.xml配置文件中的一段在struts中我这样配置:
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/configs/action-context.xml" />
</plug-in>
可是找不到sshservice这个bean
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/configs/action-context.xml,/WEB-INF/classes/configs/applicationContext.xml,......" />
</plug-in>
似乎也可以这样(这个不确定)
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/classes/configs/*-context.xml" />
</plug-in>
中加入<import resource="action-context.xml" />
<import resource="bo-context.xml" />
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sshservice' defined in ServletContext resource [/WEB-INF/classes/configs/bo-context.xml]: Cannot create inner bean 'com.wootion.services.impl.SshservicesImpl#8a6fc' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wootion.services.impl.SshservicesImpl#8a6fc' defined in ServletContext resource [/WEB-INF/classes/configs/bo-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'daoTool' of bean class [com.wootion.services.impl.SshservicesImpl]: Bean property 'daoTool' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wootion.services.impl.SshservicesImpl#8a6fc' defined in ServletContext resource [/WEB-INF/classes/configs/bo-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'daoTool' of bean class [com.wootion.services.impl.SshservicesImpl]: Bean property 'daoTool' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?org.springframework.beans.NotWritablePropertyException: Invalid property 'daoTool' of bean class [com.wootion.services.impl.SshservicesImpl]: Bean property 'daoTool' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?现在还是这一堆堆的错误!请问是怎么回事?到底错在哪里了?
主要是由于在services中注入的对象名与配置中的名字不一致