title: How to get data from JSP page to servlet
body: <p>I'm new to Servlet functionality. I'm trying to get some data in JSP Form and trying to print it in console using Servlet. But i'm not able to do that.</p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&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/web-app_2_5.xsd" 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;servlet&gt;
      &lt;servlet-name&gt;controlServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.selenium8x8.servlet.ControlServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;controlServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;  
  </code></pre>
  
  <p><strong>Startup.jsp</strong></p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;form action="Startup" method="post"&gt;
          &lt;input type="text" name="name"/&gt;&lt;br&gt;        
          &lt;input type="text" name="group"/&gt;
          &lt;input type="text" name="pass"/&gt;
          &lt;input type="submit" value="submit"&gt;            
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>ControlServlet.java</strong></p>
  
  <pre><code>import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  public class ControlServlet extends HttpServlet {
  
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          String name = request.getParameter("name");
          String group = request.getParameter("group");
          String pass = request.getParameter("pass");
          System.out.println("Name :"+ name);
          System.out.println("group :"+ group);
          System.out.println("pass :"+ pass);
      }
  
  }
  </code></pre>
  
  <p>After execution, it throws me the following error,</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.
  </code></pre>