title: Why my action can not to work in my javaWeb project?
body: <p>IDE Version:struts2.5.8+spring4.3.6+hibernate5.2.8.
  I'm a new worker in Java Web.
  After I checked carefully my code,but the action can not to work.
  Every time i'm running my code in Tomcatv9.0, my chrome web browser display en "HTTP Status 404" type Status report.
  description: The requested resource is not available.</p>
  
  <p>web.xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="MyStrutsApp" version="2.4"
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;!-- &lt;param-value&gt;/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml&lt;/param-value&gt;  --&gt;
      &lt;param-value&gt;classpath:beans.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
  &lt;filter-class&gt;org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
  &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>struts.xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
  "http://struts.apache.org/dtds/struts-2.5.dtd"&gt;
  &lt;struts&gt;
  &lt;include file="struts-default.xml"&gt;&lt;/include&gt;
  &lt;constant name="struts.i18n.encoding" value="UTF-8"&gt;&lt;/constant&gt;
  &lt;constant name="struts.action.extension" value="do,action"&gt;&lt;/constant&gt;
  &lt;constant name="struts.serve.static.browserCache" value="false"&gt;     &lt;/constant&gt;
  &lt;constant name="struts.devMode" value="true" /&gt;    
  &lt;constant name="struts.configuration.xml.reload" value="true"&gt;&lt;/constant&gt;    
  &lt;constant name="struts.enable.DynamicMethodInvocation" value="true" /&gt;     
  &lt;package name="registration" extends="struts-default" namespace="/" &gt;        
      &lt;action name="user" class="userAction" method="add"&gt;
          &lt;result name="success"&gt;/registerSuccess.jsp&lt;/result&gt;
          &lt;result name="fail"&gt;/registerFail.jsp&lt;/result&gt;
          &lt;allowed-methods&gt;add&lt;/allowed-methods&gt;
      &lt;/action&gt;        
  &lt;/package&gt;
  &lt;/struts&gt;
  </code></pre>
  
  <p>beens.xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;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.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop.xsd
         http://www.springframework.org/schema/tx 
         http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  &lt;context:annotation-config /&gt;
  &lt;context:component-scan base-package="com.diyuan" /&gt;
  &lt;!-- 
      &lt;bean id="dataSource"
      class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close"&gt; 
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="url" value="jdbc:mysql://localhost:3306/spring" /&gt;
      &lt;property name="username" value="root" /&gt;
      &lt;property name="password" value="bjsxt" /&gt;
      &lt;/bean&gt;
  --&gt;
  &lt;bean       class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;value&gt;classpath:jdbc.properties&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="dataSource" destroy-method="close"
      class="org.apache.commons.dbcp2.BasicDataSource"&gt;
      &lt;property name="driverClassName"
          value="${jdbc.driverClassName}" /&gt;
      &lt;property name="url" value="${jdbc.url}" /&gt;
      &lt;property name="username" value="${jdbc.username}" /&gt;
      &lt;property name="password" value="${jdbc.password}" /&gt;
  &lt;/bean&gt;
  &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;!-- 
      &lt;property name="annotatedClasses"&gt;
          &lt;list&gt;
              &lt;value&gt;com.bjsxt.model.User&lt;/value&gt;
              &lt;value&gt;com.bjsxt.model.Log&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
       --&gt;
       &lt;property name="packagesToScan"&gt;
          &lt;list&gt;
              &lt;value&gt;com.diyuan.integration.model&lt;/value&gt;             
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;value&gt;
              org.hibernate.dialect.MySQL5Dialect
          &lt;/value&gt;            
      &lt;/property&gt;
  &lt;/bean&gt; 
  &lt;!--
  &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  --&gt;
  &lt;bean id="txManager"        class="org.springframework.orm.hibernate5.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;    
  &lt;bean id="userDao" class="com.diyuan.integration.dao.impl.UserDaoImpl"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
  &lt;/bean&gt;
  &lt;bean id="userManager" class="com.diyuan.integration.service.impl.UserManagerImpl"&gt;
      &lt;property name="userDao" ref="userDao"/&gt;
  &lt;/bean&gt;
  &lt;bean id="userAction" class="com.diyuan.integration.action.UserAction" scope="prototype"&gt;
     &lt;property name="um" ref="userManager"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>action code:</p>
  
  <pre><code>package com.diyuan.integration.action;
  import javax.annotation.Resource;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.annotation.Scope;
  import       org.springframework.context.support.ClassPathXmlApplicationContext;
  import org.springframework.stereotype.Component;
  import com.diyuan.integration.model.User;
  import com.diyuan.integration.service.UserManager;
  import com.opensymphony.xwork2.ActionSupport;
  public class UserAction extends ActionSupport { 
      private String username;
      private String password;
      private String password2;   
      private UserManager um;
      public UserManager getUm() {
      return um;
  }
  public void setUm(UserManager um) {
      this.um = um;
  }
  @Override
  public String execute() throws Exception {
      User u = new User();
      u.setUsername(username);
      u.setPassword(password);        
      if(um.exists(u)) {         
          return "fail";
      }
      um.add(u);      
      return "success";
  }
  public String getUsername() {
      return username;
  }
  public void setUsername(String username) {
      this.username = username;
  }
  public String getPassword() {
      return password;
  }
  
  public void setPassword(String password) {
      this.password = password;
  }
  
  public String getPassword2() {
      return password2;
  }
  public void setPassword2(String password2) {
      this.password2 = password2;
  }   
  </code></pre>
  
  <p>}</p>