本帖最后由 andymu077 于 2012-10-15 18:15:29 编辑

解决方案 »

  1.   

    没有找到你配置的Action,代码太多了,给你个例子参考下:
    http://download.csdn.net/detail/peng_hao1988/4191421
      

  2.   

    #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:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.springframework.org/schema/context
               http://www.springframework.org/schema/context/spring-context-2.5.xsd
               http://www.springframework.org/schema/aop
               http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
               http://www.springframework.org/schema/tx 
               http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
               <!-- 用注解方式注入bean -->
    <context:annotation-config/>
    <context:component-scan base-package="com.template"/>

    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>

         <!-- 事物配置 -->
         <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
          <property name="sessionFactory" ref="sessionFactory"></property>
         </bean>

    <!-- hibernate sessionFactory 创建 方法1 JDBC -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

    <property name="dataSource" ref="dataSource"/>

    <!--  实体类扫描  -->
    <property name="packagesToScan">
    <list>
    <value>com.template.model</value>
    </list>
    </property>

    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.format_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    </props>
    </property>
    </bean>

    <!-- hibernate sessionFactory 创建 方法2 hibernate零配置  需要明显的GET&SET方法
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="configLocation"  value="classpath:hibernate.cfg.xml"></property>
    </bean>--> <!-- 数据库连接池 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/ssh2_template" />
    <property name="username" value="andymu" />
    <property name="password" value="andymu" />
    </bean>

         <bean id="userAction" class="com.template.action.UserAction">
     </bean>     <!-- AOP代理 -->
         <tx:advice id="txAdvice" transaction-manager="transactionManager">
          <tx:attributes>
          <tx:method name="find*" read-only="true"/>
          <tx:method name="add*" propagation="REQUIRED"/>
          </tx:attributes>
         </tx:advice>
         <aop:config>
          <aop:pointcut expression="execution(public * com.template.service..*.*(..))" id="myPointcut"/>
          <aop:advisor advice-ref="txAdvice" pointcut-ref="myPointcut"/>
         </aop:config>
         
    </beans>
      

  3.   

    真的没人明白吗?补充一下:我用的JDK1.7 Tomcat6.0
      

  4.   

     把<s:form action="login" method="post" validate="true">
    改成这样试试:
     <s:form action="/login" method="post" validate="true">
      

  5.   

    原因找到了。是我加了UserAction-validation.xml。但是加了这个之后页面是有验证了。但是通过了也不转到Action