解决方案 »

  1.   

    网上说struts.xml里action的class配置应该跟spring 的bean id一样,但是更改了之后
    严重: Dispatcher initialization failed
    Unable to load configuration. - action - file:/D:/Program%20Files%20(x86)/apache-tomcat-7.0.37/webapps/siseffa/WEB-INF/classes/struts.xml:28:48
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    报错..不能加载
      

  2.   

    struts.xml
    <action name="listMember" class="com.siseffa.struts.action.ListMember">
                <result name="success">/right.jsp</result>
            </action>片段改成
    <action name="listMember" class="listMember">
                <result name="success">/right.jsp</result>
            </action>这里的class是你applicationContext.xml中beanID
    空指针原因是你这样配置的struts.xml中service根本没有注入成功
      

  3.   

    试了改成这样,我在2楼那里阐明了,会报错,不过又查了下资料,发现我没有吧struts托管给spring 所以就算改了class为spring beanId 也会报错?
      

  4.   

    应该是没有把struts2的对象工厂交给spring管理。
    试试在struts2的xml文件里面添加:
    <constant name="struts2.ObjectFactory" value="Spring"/>
      

  5.   

    没有交给spring管理吧?struts配置文件内没有相应的说明加上
    <constant name="struts2.ObjectFactory" value="spring"/>