title: http 404 errorThe origin server did not find a current representation for the target resource or is not willing to disclose that one exists
body: <p>I am new to spring mvc and I have done have everything proper seeing a tutorial.But still I am facing Http 404 error -The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.why is that so?</p>
  
  <p>I'm using IntelliJ IDE and tomcat server to run my code.
  under WEB-INF/ I have all dispatcher-servlet,jsp,web.xml file.</p>
  
  <p>this is the controller class. I tried both the methods(/hello and /hi) but I'm not able to get successful results.</p>
  
  <pre><code>@Controller
  public class HelloController {
      @RequestMapping("/hello")
      public String printHello(ModelMap model) {
          model.addAttribute("message", "Hello Spring MVC Framework!");
          return "hello";
      }
      @RequestMapping("/hi")
      public ModelAndView hiworld(){
          ModelAndView modelAndView=new ModelAndView("hello");
          modelAndView.addObject("message","hi bro its ok");
          return modelAndView;
      }
  }
  </code></pre>
  
  <p>this the dispatcher-servlet.xml.</p>
  
  <pre><code>&lt;bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name = "prefix" value = "/WEB-INF/" /&gt;
      &lt;property name = "suffix" value = ".jsp" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>this is my web.xml file
   Spring MVC Application</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          org.springframework.web.servlet.DispatcherServlet
      &lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>In hello.jsp file, I am printing the message</p>
  
  <pre><code>&lt;body&gt;
  &lt;p&gt;${message}&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>expected result was the successful execution of jsp file.
  but I'm getting HTTP 404 ERROR-The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.</p>