title: No mapping found for HTTP request with URI.... in DispatcherServlet with name 'main'
body: <p>I am newly working on spring mvc,I am using "spring in practice" book and this is the first mvc programme which I tried and I am getting the below error</p>
  
  <pre><code> WARN  PageNotFound:1101 - No mapping found for HTTP request with URI [/MVC_BOOK_Annotation/main/list.do] in DispatcherServlet with name 'main'
  </code></pre>
  
  <p>below is my code</p>
  
  <h2>RosterController</h2>
  
  <pre><code>package com.web;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestParam;
  
  import com.model.Member;
  
  @Controller
  public final class RosterController {
      private List&lt;Member&gt; members = new ArrayList&lt;Member&gt;();
  
      public RosterController() {
          members.add(new Member("John", "Lennon"));
          members.add(new Member("Paul", "McCartney"));
          members.add(new Member("George", "Harrison"));
          members.add(new Member("Ringo", "Starr"));
      }
  
      @RequestMapping
      public void list(Model model) {
          model.addAttribute(members);
      }
  
      @RequestMapping
      public void member(@RequestParam("id") Integer id, Model model) {
          model.addAttribute(members.get(id));
      }
  }
  </code></pre>
  
  <h2>Member.java</h2>
  
  <pre><code>package com.model;
  
  public class Member {
      private String firstName;
      private String lastName;
  
      public Member() {
      }
  
      public Member(String firstName, String lastName) {
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String toString() {
          return firstName + " " + lastName;
      }
  }
  </code></pre>
  
  <h2>main-servlet.xml</h2>
  
  <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-3.2.xsd
          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
      &lt;bean class="com.web.RosterController" name="/roster/"&gt;&lt;/bean&gt;
  
      &lt;bean
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <h2>web.xml</h2>
  
  <pre><code>&lt;web-app id="AppName" 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;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;main&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;main&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/main/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <h2>list.jsp</h2>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&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=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;ul&gt;
          &lt;c:forEach var="member" items="${memberList}" varStatus="status"&gt;
              &lt;li&gt;&lt;a href="member.do?id=${status.index}"&gt; &lt;c:out
                          value="${member}"&gt;&lt;/c:out&gt;
              &lt;/a&gt;&lt;/li&gt;
          &lt;/c:forEach&gt;
      &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <h2>member.jsp</h2>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&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=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Member: ${member}&lt;/h1&gt;
      &lt;p&gt;
          &lt;a href="list.do"&gt;Back&lt;/a&gt;
      &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the above code is almost similar to the book code but still I am unable to find where is the mistake.I attached an @RequestMapping attribute to the list() and member() methods,This identifies them as request-servicing methods.Below is my project structure screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/1zE7q.png" alt="enter image description here"></p>