title: spring mvc project does not return jsp page (HTTP Status 404)
body: <p>in my spring mvc project(maven project) controller does not return jsp page</p>
  
  <p>please have a look on my <code>spring-servlet.xml</code> file</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:tx="http://www.springframework.org/schema/tx"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="
          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.xsd
          http://www.springframework.org/schema/mvc
          http://www.springframework.org/schema/mvc/spring-mvc.xsd
          http://www.springframework.org/schema/tx 
          http://www.springframework.org/schema/tx/spring-tx.xsd"&gt;
  
      &lt;!-- Add support for component scanning --&gt;
      &lt;context:component-scan base-package="com.loveTodo.springPractice.controller" /&gt;
  
      &lt;!-- Add support for conversion, formatting and validation support --&gt;
      &lt;mvc:annotation-driven/&gt;
  
      &lt;!-- Define Spring MVC view resolver --&gt;
      &lt;bean
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="prefix" value="/WEB-INF/view/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Step 1: Define Database DataSource / connection pool --&gt;
      &lt;bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
            destroy-method="close"&gt;
          &lt;property name="driverClass" value="com.mysql.jdbc.Driver" /&gt;
          &lt;property name="jdbcUrl" value="jdbc:mysql://localhost:3306/hb_student_tracker?useSSL=false" /&gt;
          &lt;property name="user" value="root" /&gt;
          &lt;property name="password" value="root" /&gt; 
  
          &lt;!-- these are connection pool properties for C3P0 --&gt;
          &lt;property name="minPoolSize" value="5" /&gt;
          &lt;property name="maxPoolSize" value="20" /&gt;
          &lt;property name="maxIdleTime" value="30000" /&gt;
      &lt;/bean&gt;  
  
      &lt;!-- Step 2: Setup Hibernate session factory --&gt; 
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="myDataSource" /&gt;
          &lt;property name="packagesToScan" value="com.loveTodo.springPractice.data" /&gt;  
          &lt;property name="hibernateProperties"&gt;  
             &lt;props&gt;
                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
             &lt;/props&gt;
          &lt;/property&gt;
     &lt;/bean&gt;    
  
      &lt;!-- Step 3: Setup Hibernate transaction manager --&gt;
      &lt;bean id="myTransactionManager"
              class="org.springframework.orm.hibernate5.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;!-- Step 4: Enable configuration of transactional behavior based on annotations --&gt;
      &lt;tx:annotation-driven transaction-manager="myTransactionManager" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>please look at my project structure
  <a href="https://i.stack.imgur.com/NSKhW.png" rel="nofollow noreferrer">maven project structure</a></p>
  
  <p>this is my controller</p>
  
  <pre><code>package com.loveTodo.springPractice.controller;
  
  import java.io.IOException;
  
  import javax.servlet.http.HttpServletResponse;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.servlet.ModelAndView;
  
  @RestController
  public class HomeController {
  
      @RequestMapping(value="/")
      public ModelAndView test(HttpServletResponse response) throws IOException{
          ModelAndView view=new ModelAndView("index");
          System.out.println("home controller");
          return view;  
      }     
  }  
  </code></pre>
  
  <p>the request coming to the controller and i am getting <code>home controller</code> sysout also. but does not return <code>index.jsp page</code> instead gives</p>
  
  <pre><code>HTTP Status 404 - /springPractice/WEB-INF/view/index.jsp
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
    &lt;display-name&gt;Scheduling Portal&lt;/display-name&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext*.xml&lt;/param-value&gt;
    &lt;/context-param&gt;  
    &lt;servlet&gt;  
      &lt;servlet-name&gt;spring&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;spring&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;     
    &lt;/servlet-mapping&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;   
  
  &lt;/web-app&gt;    
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.loveTodo&lt;/groupId&gt;
      &lt;artifactId&gt;springPractice&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;name&gt;springPractice&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.6&lt;/java.version&gt;
          &lt;spring.version&gt;3.1.0.RELEASE&lt;/spring.version&gt;
          &lt;cglib.version&gt;2.2.2&lt;/cglib.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Spring core &amp; mvc --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;4.3.2.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.3.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
      &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
      &lt;version&gt;8.5.6&lt;/version&gt;
  &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- CGLib for @Configuration --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;cglib&lt;/groupId&gt;
              &lt;artifactId&gt;cglib-nodep&lt;/artifactId&gt;
              &lt;version&gt;${cglib.version}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&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.6&lt;/version&gt;
  &lt;/dependency&gt;
  
          &lt;!-- Servlet Spec --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;  
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
      &lt;version&gt;5.2.16.Final&lt;/version&gt;
  &lt;/dependency&gt;
          &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
      &lt;version&gt;5.2.16.Final&lt;/version&gt;
  &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;springsource-milestones&lt;/id&gt;
              &lt;name&gt;SpringSource Milestones Proxy&lt;/name&gt;
              &lt;url&gt;https://oss.sonatype.org/content/repositories/springsource-milestones&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;springPractice&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.0.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${java.version}&lt;/source&gt;
                      &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>i have configured everything please help me out</p>