title: HTTP Status 404 Spring MVC Passing Parameters
body: <p>I want to start work with Spring MVC, but can not adjust a simple example. I want to just pass one parameter form one jsp to another, but have error:</p>
  
  <blockquote>
    <p>HTTP Status 404 - /controller/results.jsp type Status report message
    /controller/results.jsp description The requested resource
    (/controller/results.jsp) is not available. Apache Tomcat/7.0.12</p>
  </blockquote>
  
  <p>My web.xml code:</p>
  
  <pre><code>&lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/root-context.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;!-- Processes application requests --&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;appServlet&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/spring/appServlet/servlet-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
          &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;appServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/home&lt;/url-pattern&gt;
          &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Servlet-context.xml</p>
  
  <pre><code>&lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt;
  
      &lt;!-- Enables the Spring MVC @Controller programming model --&gt;
      &lt;annotation-driven /&gt;
  
      &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt;
      &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
      &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt;
      &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt;
          &lt;beans:property name="suffix" value=".jsp" /&gt;
      &lt;/beans:bean&gt;
  
      &lt;context:component-scan base-package="edu.demidov.controller" /&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>Controller.java</p>
  
  <pre><code>@Controller
  public class HomeController extends HttpServlet{
  
      private static final long serialVersionUID = 4825408935018763217L;  
  
      private static final Logger logger = LoggerFactory.getLogger(HomeController.class);      
  
      EducationDaoInterface educationDaoIntfc;
  
      @RequestMapping(value="/home", method=RequestMethod.GET)
      public ModelAndView  firstActionPage() {    
  
          return new ModelAndView("home");
  
      }
  
  
      @RequestMapping(value = "/result.jsp", method=RequestMethod.GET)
      public String SecondActionPage(@RequestParam String firstname, Model model) throws IOException {
  
          model.addAttribute("myname", firstname);
  
          return "result";
  
      }
  </code></pre>
  
  <p>Result.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&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=UTF-8"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  Hello form result.jsp
  
  First name: ${myname}
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Home.jsp</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%&gt;
      &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&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=UTF-8"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form name="myform" action="&lt;c:url value="/results.jsp"/&gt;" method="GET"&gt;
  
  &lt;input type="text"  name="firstname"/&gt;
  
  &lt;input type="submit"/&gt;
  
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks.</p>