title: controller class mapping in spring mvc
body: <p>org.springframework.web.servlet.PageNotFound noHandlerFound</p>
  
  <p>I was not able to find the error in the following code as i am just learning spring mvc.
  Not able to map the request in the controller class and tried to check the configuration files but was not able to find the error. kindly help me with the program.</p>
  
  <p>web.xml</p>
  
  <pre><code> &lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  
   &lt;web-app&gt;
   &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
  
  
   &lt;servlet&gt;
    &lt;servlet-name&gt;telusko&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;telusko&lt;/servlet-name&gt;
     &lt;url-pattern&gt;/&lt;/url-pattern&gt;
   &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>telusko-servlet.xml</p>
  
  <pre><code>   &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:ctx="http://www.springframework.org/schema/context"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     http://www.springframework.org/schema/mvc 
     http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
  
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-2.5.xsd "&gt;
    &lt;ctx:annotation-config&gt;&lt;/ctx:annotation-config&gt;
    &lt;ctx:component-scan base-package="com.telusko"&gt;&lt;/ctx:component-scan&gt;
    &lt;/beans&gt; 
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code> &lt;project xmlns="http://maven.apache.org/POM/4.0.0"     
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
   http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.pluralsight&lt;/groupId&gt;
  &lt;artifactId&gt;teludkospringmvc&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;teludkospringmvc Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
   &lt;dependencies&gt;
  
    &lt;dependency&gt;
       &lt;groupId&gt;junit&lt;/groupId&gt;
       &lt;artifactId&gt;junit&lt;/artifactId&gt;
       &lt;version&gt;3.8.1&lt;/version&gt;
       &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
       &lt;groupId&gt;org.springframework&lt;/groupId&gt;
       &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
       &lt;version&gt;4.1.8.RELEASE&lt;/version&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
      &lt;version&gt;4.1.8.RELEASE&lt;/version&gt;
   &lt;/dependency&gt;
  
   &lt;dependency&gt;
     &lt;groupId&gt;mysql&lt;/groupId&gt;
     &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
     &lt;version&gt;5.1.36&lt;/version&gt;
   &lt;/dependency&gt;
  
   &lt;dependency&gt;
     &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
     &lt;artifactId&gt;jstl&lt;/artifactId&gt;
     &lt;version&gt;1.2&lt;/version&gt;
   &lt;/dependency&gt; 
  
   &lt;/dependencies&gt;
   &lt;build&gt;
   &lt;finalName&gt;teludkospringmvc&lt;/finalName&gt;
   &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>package com.telusko;
  import org.springframework.stereotype.Controller;
  import  org.springframework.web.bind.annotation.RequestMapping; 
  @Controller
  public class AddController {
  
  @RequestMapping("/add")
  public void add(){
  System.out.print("hi");
  }
  
  }
  </code></pre>
  
  <p>ErrorResult</p>
  
  <pre><code>WARNING: No mapping found for HTTP request with URI [/teludkospringmvc/add] 
  in DispatcherServlet with name 'telusko'
  </code></pre>