本帖最后由 fancyLeeo 于 2010-09-03 11:44:55 编辑

解决方案 »

  1.   

    添加个set方法。
    然后在spring的配置文件中定义个
    <bean id="crmAdManager"
    class="对应具体的某个类。"/>
    通过自动装配需要导入:struts2-spring-plugin-xxx.jar包
      

  2.   

    同样的问题在这个帖子里面也有。
    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。
      

  3.   

      <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包