struts整合spring的配置 按照你这个配置应该是通过struts-config.xml中的spring plugin来整合的将action的AuthDAO去掉可以运行吗?
com.yourcompany.struts.action.LoginAction里有setDao方法吗?

解决方案 »

  1.   

    是用plugin整合的 把AuthDAO去掉还有sessionfactory也注掉,单独注入person属性就是可以的 也有set方法
    怀疑是hibernate影响的,但是不通过action,直接测试AuthDAO Bean 可以访问到数据库,很奇怪?!
      

  2.   


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
      <data-sources />
      <form-beans >
        <form-bean name="loginForm" type="com.yourcompany.struts.form.LoginForm" />  </form-beans>  <global-exceptions />
      <global-forwards />
      <!-- 
      <action-mappings >
        <action
          attribute="loginForm"
          input="/form/login.jsp"
          name="loginForm"
          path="/login"
          scope="request"
          type="com.yourcompany.struts.action.LoginAction">
          <forward name="success" path="/form/success.jsp" />
        </action>  </action-mappings>  
      -->
        <action-mappings >
        <action
          attribute="loginForm"
          input="/form/login.jsp"
          name="loginForm"
          path="/login"
          scope="request"
          type="org.springframework.web.struts.DelegatingActionProxy">
          <forward name="success" path="/form/success.jsp" />
        </action>  </action-mappings>    <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
      <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
      <set-property property="contextConfigLocation" value="/WEB-INF/classes/applicationContext.xml" />
      </plug-in>
    </struts-config>
      

  3.   

    <value>file:src/hibernate.cfg.xml</value>
    改为<value>classpath:hibernate.cfg.xml</value>试试
      

  4.   

    可以了,谢啊!!!是不是因为两种分别对应于spring的ClassPathXmlApplicationContext和FileSystemXmlApplicationContext,我在测试的时候用后者也不行,提示在/bin/下找不到applicationContext
    ,只是没想到要改这里,可为什么file的就不行?