sturts2中注入的属性来自spring的bean如何做? 本帖最后由 fancyLeeo 于 2010-09-03 11:44:55 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 添加个set方法。然后在spring的配置文件中定义个 <bean id="crmAdManager" class="对应具体的某个类。"/>通过自动装配需要导入:struts2-spring-plugin-xxx.jar包 同样的问题在这个帖子里面也有。http://topic.csdn.net/u/20100830/11/5d16fbfb-dfc1-4613-aecd-75526f1b6d9e.htmlStruts 2 支持Spring的plug功能,能够从Spring的配置文件中获取对象。即Strut 2提供了Context来plug Spring Context,通过Action 的class属性值关联Spring的配置bean id。具体的做法参照 Struts 2.1.8 showcase 中的web.xml、application.xml 和 struts-chat.xml。 <action name="login" class="spring中注册的beanID" method="login"> <result name="success" type="redirect">/jsp/index.jsp</result> </action>spring中 <bean id="你的beanID" class="具体类路径和类名" scope="prototype"> <property name="crmAdManager"> <ref bean="crmAdManager类在spring中注册的beanid"/> </property></bean>crmAdManager在action中要有get,set方法。同时要导入:struts2-spring-plugin-xxx.jar包 Spring 初学的不明错误 java通过corba调用C++服务,返回大数据对象时出错 关于SSH框架,启动tomcat1.6问题 在线求教hibernate hql语句的插入问题 60分求教高手SSH项目在MyEclipse上无法以开发模式部署,问题一经解决立即结贴给分,在线等。。。 理想的编程语言 jms消息接收采用queue的方式,网络断了的话,消息接收不能重新监听和获得消息.请高手指点 weblogic8.1问题求助? 看着托普(TOP)快倒了,真是高兴,散分 tomcat 4.1.29 乱码问题??!!!! 大家來說說使用DWR的不好的一面 得到地址栏的IP
然后在spring的配置文件中定义个
<bean id="crmAdManager"
class="对应具体的某个类。"/>
通过自动装配需要导入:struts2-spring-plugin-xxx.jar包
http://topic.csdn.net/u/20100830/11/5d16fbfb-dfc1-4613-aecd-75526f1b6d9e.html
Struts 2 支持Spring的plug功能,能够从Spring的配置文件中获取对象。
即Strut 2提供了Context来plug Spring Context,通过Action 的class属性值关联Spring的配置bean id。具体的做法参照 Struts 2.1.8 showcase 中的web.xml、application.xml 和 struts-chat.xml。
<result name="success" type="redirect">/jsp/index.jsp</result>
</action>spring中
<bean id="你的beanID" class="具体类路径和类名" scope="prototype">
<property name="crmAdManager">
<ref bean="crmAdManager类在spring中注册的beanid"/>
</property>
</bean>crmAdManager在action中要有get,set方法。
同时要导入:struts2-spring-plugin-xxx.jar包