title: Method undefined for type HttpServlet error in Java
body: <p>I am getting the above message when I use respond with a method and I don't have any clues on how to fix it, I have java servlet 3.1 which seems to be the only answer I can find elsewhere that could resolve it.</p>
  
  <pre><code>import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.sql.*;
  
  public class login extends HttpServlet {
  
  protected void doPost(HttpServletRequest request, HttpServlet response) throws ServletException, IOException {
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
  
      String username = request.getParameter("username");
      String password = request.getParameter("password");
  
      if(Validate.checkUser(username, password))
      {
          RequestDispatcher rs = request.getRequestDispatcher("Welcome");
          rs.forward(request, response);
      }
      else
      {
          out.println("Username or Password incorrect");
          RequestDispatcher rs = request.getRequestDispatcher("login.html");
          rs.include(request, response);
      }
  }
  
  }
  </code></pre>