别人的项目struts2+spring3.1+hibernate3,开始是说loginAction找不到名为success的result,但是在struts.xml中有login的action配置,也有result,于是把这个action配置删了,竟然还能调用到原来的LoginAction类,最后把struts.xml都删了,还能调到这个LoginAction类!!!
已经把Eclipse重启、Tomcat下webapps和work里的项目清空、重新发布、重新启动Tomcat、清空IE缓存做了N次了,还不行,为啥?有什么默认的login配置么?

解决方案 »

  1.   

    web项目从web.xml开始看起,看看都有哪些配置,然后根据配置路径一个个去找
    web.xml是万物之源!!!
      

  2.   

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <filter>
    <filter-name>sessionClose</filter-name>
    <filter-class>com.lntu.filters.SessionFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>sessionClose</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>sessionClose</filter-name>
    <url-pattern>*.action</url-pattern>
    </filter-mapping>
    <!-- session关闭过滤器 --> <!-- 配置log4j -->
    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>personmanager.root</param-value>
    </context-param>
    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>
    <context-param>
    <param-name>log4jRefreshInterval</param-name>
    <param-value>60000</param-value>
    </context-param>
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <!-- 配置log4j结束 --> <!-- 配置jfreechart -->
    <servlet>
    <servlet-name>DisplayChart</servlet-name>
    <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>DisplayChart</servlet-name>
    <url-pattern>/servlet/DisplayChart</url-pattern>
    </servlet-mapping>
    <!-- 配置jfreechart 结束 --> <!-- 配置spring -->
    <!-- 如果不指定contextConfigLocation, 则默认从/EWB-INF/下查找applicationContext.xml文件 -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    classpath*:applicationContext*.xml
    </param-value>
    </context-param>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- 配置spring结束 --> <!-- 配置dwr -->
    <!-- 需要配置文件dwr-servlet.xml,其中dwr和servlet-name相同 -->
    <!-- <servlet> <servlet-name>dwr</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dwr</servlet-name> 
    <url-pattern>/dwr/*</url-pattern> </servlet-mapping> -->
    <servlet>
    <servlet-name>dwr</servlet-name>
    <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
    <!-- 使用org.directwebremoting.spring.DwrSpringServlet,不需要原来的dwr-servlet.xml配置文件 -->
    <!-- 使用org.directwebremoting.spring.DwrSpringServlet,下面四行必须有,否则会报错Access 
    to debug pages is denied. -->
    <!-- dwr的配置信息直接放applicationContext.xml中 -->
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>dwr</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    <!-- 配置dwr结束 -->
    <!-- 定义编码过滤器 -->
    <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>utf-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!-- 定义编码过滤器结束 -->

    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
      

  3.   

     <!-- 如果不指定contextConfigLocation, 则默认从/EWB-INF/下查找applicationContext.xml文件 -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                classpath*:applicationContext*.xml
            </param-value>
        </context-param>
    很明显,下一个查找对象是这个..
      

  4.   

    那是不可能的,只不过把xml变成注解而已,那样更零散,更加难以管理和理解,在大型项目中一般都不会推荐使用注解来替代配置的
      

  5.   

    只有一个applicationContext.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xmlns:cache="http://www.springframework.org/schema/cache"
    xsi:schemaLocation="http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    http://www.directwebremoting.org/schema/spring-dwr    
    http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd
    http://www.springframework.org/schema/cache
    http://www.springframework.org/schema/cache/spring-cache-3.1.xsd"> <!-- 使用Spring的Annotation -->
    <context:annotation-config />
    <context:component-scan base-package="com.lntu.admin">
    </context:component-scan> <dwr:configuration />
    <dwr:annotation-config />
    <dwr:url-mapping />
    <dwr:annotation-scan scanRemoteProxy="true"
    base-package="com.*" /> <!-- 部署项目时, 请把debug设为false -->
    <dwr:controller id="dwrController" debug="true" /> <cache:annotation-driven cache-manager="cacheManager" /> <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
    <property name="caches">
    <set>
    <bean
    class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean"
    p:name="default" />
    <bean
    class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean"
    p:name="andCache" />
    </set>
    </property>
    </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver" />
    <property name="jdbcUrl"
    value="jdbc:jtds:sqlserver://localhost:1433/PersonSystem" />
    <property name="user" value="sa" />
    <property name="password" value="tft7600" />
    <property name="maxPoolSize" value="40" />
    <property name="minPoolSize" value="1" />
    <property name="initialPoolSize" value="1" />
    <property name="maxIdleTime" value="20" />
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="mappingResources">
    <list>

    …… </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    </props>
    </property>
    </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"
    abstract="false" lazy-init="default" autowire="default">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="genericDAOImpl" class="com.lntu.admin.dao.impl.HibernateGenericDAOImpl"
    abstract="false" lazy-init="default" autowire="default">
    <property name="hibernateTemplate">
    <ref bean="hibernateTemplate" />
    </property>
    </bean></beans>零配置也得有配置啊,annotation?aop?都得有线索啊?
      

  6.   

    这就很诡异了,我在想 你操作的项目是不是 和你tomcat 发布的项目 是同步的。
      

  7.   

     <!-- 使用Spring的Annotation -->
        <context:annotation-config />
        <context:component-scan base-package="com.lntu.admin">
        </context:component-scan>
     注解啊,这个有点汗啊,包就是这个com.lntu.admin,去相应包下看看吧,估计就在那个类的头上标着呢.....
      

  8.   

    会不会tomcat中有些文件没更新啊。
      

  9.   

    类中有木有注解  或者干脆  LoginAction   CTRL+H  *.XML