title: Spring MVC: 404 The requested resource is not available
body: <p>I am new in Spring MVC. Test "helloworld" example in localhost:8080 it is fine.<br>
  But I create my own project then come with 404 The requested resource is not available.</p>
  
  <p>web.xml<br></p>
  
  <pre><code>&lt;web-app 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_3_0.xsd"
      version="3.0"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
    &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>mvc-dispatcher-servlet.xml<br></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd"&gt;
      &lt;context:component-scan base-package="com.tachubsystems.TERMS.controller"&gt;&lt;/context:component-scan&gt;
      &lt;mvc:annotation-driven&gt;&lt;/mvc:annotation-driven&gt;
      &lt;bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/jsp/"&gt;&lt;/property&gt;
          &lt;property name="suffix" value=".jsp"&gt;&lt;/property&gt;
      &lt;/bean&gt;
   &lt;/beans&gt;
  </code></pre>
  
  <p>LoginController.java<br></p>
  
  <pre><code>package com.tachubsystems.TERMS.controller;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  @Controller
  public class LoginController {
      @RequestMapping("/login")
      public String test()
      {
       return "login";
      }
  }
  </code></pre>
  
  <p>file directory: <a href="http://i.stack.imgur.com/D1cxH.png" rel="nofollow">http://i.stack.imgur.com/D1cxH.png</a> <br>
  404 error page: <a href="http://i.stack.imgur.com/CIcjW.png" rel="nofollow">http://i.stack.imgur.com/CIcjW.png</a></p>