title: getting error HTTP Status 405 - HTTP method GET is not supported by this URL but not used `get` ever?
body: <p>I'm a beginner and making a small registration program with database But i'm trying to run this but it's giving me some errors pls help:</p>
  
  <pre><code>HTTP Status 405 - HTTP method GET is not supported by this URL
  
  type Status report
  
  message HTTP method GET is not supported by this URL
  
  description The specified HTTP method is not allowed for the requested resource.
  Apache Tomcat/8.0.5
  </code></pre>
  
  <p>And here is my <code>register.html</code> codes:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head lang="en"&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="Register" method="post"&gt;
      Name: &lt;input type="text" name="name"&gt;
      Email: &lt;input type="text" name="email"&gt;
      Password: &lt;input type="password" name="password"&gt;
      Country:
  
      &lt;select name="userCountry"&gt;
          &lt;option&gt;India&lt;/option&gt;
          &lt;option&gt;Pakistan&lt;/option&gt;
          &lt;option&gt;Other&lt;/option&gt;
      &lt;/select&gt;&lt;br&gt;&lt;br&gt;
  
      &lt;input type="submit" value="register"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my <code>Register.java</code> codes:</p>
  
  <pre><code>import java.sql.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  
  public class Register extends HttpServlet{
      public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
          response.setContentType("text/html");
          PrintWriter out=response.getWriter();
  
          String n=request.getParameter("name");
          String p=request.getParameter("password");
          String e=request.getParameter("email");
          String c=request.getParameter("userCountry");
  
          try{
              Connection con=DriverManager.getConnection(
                      "jdbc:mysql://localhost:8888", "root", "1234"
              );
  
              PreparedStatement ps=con.prepareStatement("insert into REGISTERUSER values(?, ?, ?, ?)");
  
              ps.setString(1,n);
              ps.setString(2,p);
              ps.setString(3,e);
              ps.setString(4,c);
  
              int i=ps.executeUpdate();
              if(i&gt;0){
                  out.print("Registered successfully..");
              }
  
          }catch(Exception d){d.printStackTrace();}
          out.close();
      }
  }
  </code></pre>
  
  <p>And here is my <code>Web.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
           version="3.1"&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;Register&lt;/servlet-name&gt;
          &lt;servlet-class&gt;Register&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Register&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/register.html&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;register.html&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Help would be appreciated!!</p>