title: Submit button in servlet is not working
body: <p>I am trying to make a servlet which will get the data from the html page. I am new to java servlets. When I run the servlet it displays the html page but the submit button does nothing. Please help me figure out what step I am missing. </p>
  
  <p>The html file <strong>/WebContent/index.html</strong> is as follows </p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
    &lt;html&gt;
      &lt;head&gt;
          &lt;style&gt;
              #box{
                  width: 92%;
                  padding: 25px;
                  border: 5px solid black;
                  margin: 25px;
              }
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id = "box"&gt;
              &lt;form action ="/src/XXXXXX/servletEX" method="post" id = "summary"&gt;
                  Purchase Order : &lt;input type="text" name="order"&gt;&lt;br&gt;
                  Invoice : &lt;input type="text" name="invoice"&gt;&lt;br&gt;
                  Invoice Date : &lt;input type="date" name="date"&gt;&lt;br&gt;
                  Supplier Tax ID : &lt;input type="text" name="taxid"&gt;&lt;br&gt;
                  &lt;p&gt;Remit to : &lt;/p&gt;
                  &lt;p&gt;Bill to :&lt;/p&gt;
              &lt;/form&gt;
          &lt;/div&gt;
          &lt;div id = "box"&gt;
              &lt;form action = "/src/XXXXXX/servletEX" method ="post" id = "tax"&gt;
                  SHIPPING  &lt;input type="checkbox"  value="head"&gt; Header Level Shipping
                  &lt;input type="checkbox"  value="line" checked&gt; Line Level Shipping &lt;br&gt;
                  &lt;span&gt;Ship from _____________________&lt;/span&gt;
                  &lt;span&gt;Ship to  _______________________&lt;/span&gt;
              &lt;/form&gt;
          &lt;/div&gt;
          &lt;div id = "box"&gt;
              &lt;h4&gt;Additional Field Only&lt;/h4&gt;
              &lt;form action = "/src/XXXXXX/servletEX" method="post" id = "additional"&gt;
                  &lt;input type="checkbox"  value="head"&gt; information only, No action required from customers &lt;/br&gt;
                  &lt;span&gt; Supplier Account ID: &lt;input type="text" name="order"&gt; &lt;/span&gt; 
                  &lt;span&gt; Service Start Date : &lt;input type="date" name="date"&gt;&lt;/span&gt;&lt;br&gt;
                  &lt;span&gt; Customer refrence : &lt;input type="text" name="order"&gt; &lt;/span&gt; 
                  &lt;span&gt; Service End Date : &lt;input type="date" name="date"&gt;&lt;/span&gt;
                  Payment Note : &lt;input type="text" name="order"&gt;&lt;/br&gt;
                  &lt;span&gt;Supplier ____________________&lt;/span&gt;
                  &lt;span&gt;Customer ____________________&lt;/span&gt;&lt;br&gt;
                  Email : &lt;input type="text" name="order"&gt;&lt;/br&gt;
                  Bill from : &lt;input type="text" name="order"&gt;&lt;/br&gt;
                  &lt;h4&gt; SUPPLIER VAT&lt;/h4&gt;
                  Supplier VAT/Tax ID : &lt;input type="text" name="order"&gt;&lt;/br&gt;
              &lt;/form&gt;
          &lt;/div&gt;
          &lt;div&gt;
  
              &lt;input type="submit" name="submit" &gt;
              &lt;input type="reset" name="reset" &gt;
  
           &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The xml file <strong>/WebContent/WEB-INF/web.xml</strong> is as follows</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;servlet&gt;
      &lt;servlet-name&gt;servletEX&lt;/servlet-name&gt;
      &lt;servlet-class&gt;XXXXXX.servletEX&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;servletEX&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/servletEX&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>..and following is the servlet code <strong>/JavaResources/src/(package)/servletEX.java</strong></p>
  
  <pre><code>package XXXXXXX;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.net.URL;
  import java.util.Enumeration;
  
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.omg.CORBA.portable.InputStream;
  
  
  
  
  public class servletEX extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public servletEX() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          doGet(request, response);
  
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
          response.setContentType("text/html");
          PrintWriter out=response.getWriter();
          out.println("&lt;html&gt;&lt;head&gt;");
          out.println("&lt;title&gt;Servlet Parameter&lt;/title&gt;");
          out.println("&lt;/head&gt;");
          out.println("&lt;body&gt;");
          Enumeration parameters = request.getParameterNames();
          String param=null;
  
              System.out.println ("Its here") ;
              while (parameters.hasMoreElements())
              {
  
                    param=(String)parameters.nextElement();                  
                    System.out.println (param + " " + request.getParameter(param));
                    out.println(param + ":" + request.getParameter(param) + "&lt;br&gt;" );                  
              }
         out.println("&lt;/body&gt;&lt;/html&gt;");
  
         out.close();
      }
  
  
  
  }
  </code></pre>