title: Spring MVC. HTTP Status 404
body: <p>I began to learn "Spring MVC" from this course: <a href="http://www.pluralsight.com/training/Courses/TableOfContents/springmvc-intro" rel="nofollow noreferrer">http://www.pluralsight.com/training/Courses/TableOfContents/springmvc-intro</a>
  At step "Building->Run the Application" I'm stuck.</p>
  
  <p>When I try to go to link <code>http://localhost:8080/FitnessTracker/greeting.html</code>
  I get "HTTP Status 404"</p>
  
  <pre><code>HTTP Status 404 - /FitnessTracker/WEB-INF/jsp/Hello.jsp
  type Status report
  message /FitnessTracker/WEB-INF/jsp/Hello.jsp
  description The requested resource is not available.
  Apache Tomcat/7.0.50
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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_2_5.xsd"
      version="2.5"&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;fitTrackerServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;/WEB-INF/config/servlet-config.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;fitTrackerServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.html&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>servlet-config.xml</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:mvc="http://www.springframework.org/schema/mvc"
      xmlns:p="http://www.springframework.org/schema/p"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
          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-3.2.xsd"&gt;
  
    &lt;mvc:annotation-driven /&gt;
    &lt;context:component-scan base-package="com.pluralsight.controller"&gt;&lt;/context:component-scan&gt;
  
    &lt;!--
    &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix" value="/WEB-INF/jsp/"/&gt;
      &lt;property name="suffix" value=".jsp"/&gt;
    &lt;/bean&gt;
    --&gt;
  
    &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>HelloController.java</p>
  
  <pre><code>package com.pluralsight.controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class HelloController {
  
      @RequestMapping(value = "/greeting")
      public String sayHello (Model model) {
          model.addAttribute("greeting", "Hello WorldX");
          return "Hello"; 
      }
  }
  </code></pre>
  
  <p>hello.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=US-ASCII"
      pageEncoding="US-ASCII"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;${greeting}&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/YG7rY.png" alt="enter image description here"></p>
  
  <p><code>http://localhost:8080/FitnessTracker/</code> - it's work (file: webapp/index.jsp)</p>