我知道一种整合的方式是:
在struts-config.xml中,加入:
<controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor"/>
但是这种方式整合后,我如果想在我的action中做:
ServletContext context=this.getServlet().getServletContext();
则会报空指针,怎么想都想不通,为什么得不到了?何况delegatingRequestProcessor还继承了struts的requestprocessor。

解决方案 »

  1.   

    让你看我下我们项目的配置,看看对你有没帮助
    struts-config.xml中,
    <action  path="/splitPage" scope="request" type="org.springframework.web.struts.DelegatingActionProxy"  validate="false">
    <forward name="pagelist" path="/pagelistDemo.jsp"></forward>
        </action>applicationContext.xml 中,
    <bean name="/splitPage" class="com.kingdo.common.test.SplitPageAction" singleton="false">
    <property name="pageinate"> //业务层接口和实现类的注入 <ref bean="pageinate" />
    </property>
    </bean>SplitPageAction  继承 org.apache.struts.action.Action;
    重写public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 方法。

      

  2.   

    <!-- Spring ApplicationContext 载入 
      --> 
    - <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
      </listener>
    web.xml中这个加了没有
      

  3.   

    无耻!又是个倒分的,浪费大家感情来给你解决问题!这是他发的贴
    http://forum.csdn.net/PointForum/SearchTopic.aspx?bigclassid=00000000-0000-0000-0000-000000000000&smallclassid=df8a1eb4-7ecb-4fcd-a9ae-1be6fd084aeb&searchtype=big&subject=&username=albertadream&pb=pb