用struts spring整合说找不到Action类,
struts.xml
<package name="default" namespace="/" extends="struts-default">
<action name="add" class="userAction" method="add">
<result type="redirectAction">
<param name="actionName">list</param>
</result>
</action>
</package>
appliactionContext.xml
<bean id="userAction" class="com.swart.action.UserAction">
<property name="student">
<ref bean="studentUser"/>
</property>
</bean>
但把class换成完整路就没问题了,包应该加够了。

解决方案 »

  1.   

    <constant name="struts.objectFactory" value="spring"/>
    这句我也加上了
    还有MyElipse里的Struts2  Spring Libraries也有。
      

  2.   

    1、你的web.xml中有这个配置吗?
    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    2、还有struts.xml中加一句配置试试:<controller processorClass="org.springframework.web.struts.DeleGatingRequestProcessor" />
    3、appliactionContext.xml里加一个属性:
    <bean id="userAction" class="com.swart.action.UserAction" scope="prototype">
      

  3.   

    要是配置 了什么的都对的话 
    看看是不是更新过jdk啊  有的时候编译环境不一样了也会找不到action的
      

  4.   

    class换成完整路就没问题了
    是spring里的配置出问题了,要么二个框架没整合
      

  5.   


    第一个加了,第二个我配置的常量
    <constant name="struts.objectFactory" value="spring"/>
    第三个也写了。
      

  6.   

    这是web.xml的内容
    <?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">
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <!-- 
      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/src/applicationContext.xml</param-value>
      </context-param>
      -->
      <!-- 用来定位Spring XML文件的上下文配置 -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
    </context-param>
      <listener>
      <listener-class>
      org.springframework.web.context.ContextLoaderListener
      </listener-class>
      </listener>
     
      <filter>
       <filter-name>struts2</filter-name>
       <filter-class>
       org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
       </filter-class>
      </filter>
      <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>/*</url-pattern>
      </filter-mapping></web-app>
    这个是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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.mysql.jdbc.Driver">
    </property>
    <property name="url" value="jdbc:mysql://localhost:3306/ssh"></property>
    <property name="username" value="root"></property>
    <property name="password" value="12345"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list><value>com/swart/entity/user.hbm.xml</value></list>
    </property>
    </bean>
    <bean id="userDao" class="com.swart.dao.impl.UserDaoImpl">
    <property name="sessionFactory">
    <ref bean ="sessionFactory"/>
    </property>
    </bean>
    <bean id="studentUser" class="com.swart.bussiness.impl.StudentUserImpl">
    <property name="dao">
    <ref bean = "userDao"/>
    </property>
    </bean>
    <bean id="userAction" class="com.swart.action.UserAction">
    <property name="student">
    <ref bean="studentUser"/>
    </property>
    </bean>
    <!-- 配置事务管理 -->
    <!-- 配置事务管理器,将事务交给Spring管理 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    </bean>
    </beans>
      

  7.   

    应该是加少了个sturts-spring-plugin.jar包吧,我也是经常遇到这个问题