title: Spring Tool Suite.HTTP Status 404 -The requested resource is not available
body: <p>I'm working with Spring Tool Suite and I want to be redirected to a jsp (rapports.jsp) from sevelet.But I can't do so .I get this error:  </p>
  
  <p>HTTP Status 404 - /rapports.jsp
  type Status report</p>
  
  <p>message: /rapports.jsp</p>
  
  <p>description:The requested resource is not available.</p>
  
  <p><strong>This is my controller:</strong></p>
  
  <pre><code>package com.mycompany.myapp;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.ResponseStatus;
  import org.springframework.web.servlet.ModelAndView;
  import org.springframework.http.HttpStatus;
  
  import javax.servlet.ServletConfig;
  
  import java.io.*;
  import java.util.*;
  
  import javax.sql.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  import org.apache.tools.ant.util.Base64Converter;
  import javax.servlet.ServletConfig;
  
  @Controller
  public class HomeController extends HttpServlet {
  
  private static final long serialVersionUID = 1L;
  
  @RequestMapping(value = "/", method = RequestMethod.GET)
  public ModelAndView adminPage() {
  ModelAndView model = new ModelAndView();
  
  model.setViewName("authentification");
  
  return model;}
  
  
  
  @RequestMapping(method=RequestMethod.POST)
    public void service(HttpServletRequest request,  HttpServletResponse response)
                throws IOException, ServletException{
  
                String Str1 = request.getParameter("smya");  
                String Str2 = request.getParameter("mdps");
                System.out.println(Str1);
                System.out.println(Str2);
  
  try {
      URL url = new URL("http://pc-demo-bi:8090/jasperserver-pro/rest/login?j_username="+Str1+"&amp;j_password="+Str2);
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();
      conn.setRequestMethod("GET");
      conn.setRequestProperty("Accept", "application/json");
  
  
                      if (conn.getResponseCode() != 200) {
                          throw new RuntimeException("Failed : HTTP error code : "
                                  + conn.getResponseCode());
                      }
  
  
                          System.out.println("connected");
                          response.sendRedirect("/rapports.jsp");
  
  
                      conn.disconnect();
  
                    } catch (MalformedURLException e) {
  
                      e.printStackTrace();
  
                    } catch (IOException e) {
  
                      e.printStackTrace();
  
                    }
  
                  }
  
  }
      as you see I have used: response.sendRedirect("/rapports.jsp") to do so.
  </code></pre>
  
  <p><strong>and this is my Web.xml:</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  
  &lt;!-- The definition of the Root Spring Container shared by all Servlets and Filters --&gt;
  &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;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is my rapport.jsp</p>
  
  <pre><code>&lt;title&gt;hahahah&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   Welcome!!
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>thanks in advance if you have any suggestion.</p>