Q: How to map submit button of a JSP to a servlet to? I am old to JAVA but very new to the topics of JSPs & Servlets. I am trying to do some jdbc operations by taking the values from JSP into servlet. To do that, I have written a JSP with a drop down list and a submit button.
Jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<body>
<div align='left' >
    <div align='left' >
        <label class="text-white mb-3 lead">Which report do you want to generate?</label>
        <select id="reportSelection" data-style="bg-white rounded-pill px-5 py-3 shadow-sm " class="selectpicker w-100" name="reportselection">
            <option>Outage</option>
            <option>DataQuality</option>
            <option>Latency</option>
        </select>

        </head>
        <body>
        <p id = "demo"> </p>
        <script>
            var d = new Date();
            document.getElementById("demo").innerHTML = d;
        </script>
        </body>
    </div>
</div>
</body>

<hr class="colorgraph">
<div class="row">
    <div class="col-xs-12 col-md-6"><input type="submit" value="Submit" class="btn btn-primary btn-block btn-lg register" tabindex="7"></div>
</div>
</body>
</html>

And this is how my servlet class looks like.
@WebServlet("/getdata.do")
public class DataServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        GetTableColumn gt = new GetTableColumn();
        String issue      = request.getParameter("reportSelection");
        String message;
        try {
            if ("Latency".equals(issue)) {
                message = gt.process("latency");
            } else if ("DataQuality".equals(issue)) {
                message = gt.process("DataQuality");
                System.out.println("Data quality");
            } else if ("Outage".equals(issue)) {
                message = gt.process("Outage");
            }
        } catch (SQLException s) {
            s.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

I am reading the JSP drop down values in my servlet class and passing a String to method process based on the value received. I looked online to configure the web.xml file as below.

http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
<servlet>
    <servlet-name>DataServlet</servlet-name>
    <display-name>DataServlet</display-name>
    <description>Begin servlet</description>
    <servlet-class>com.servlets.DataServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>DataServlet</servlet-name>
    <url-pattern>/parse</url-pattern>
</servlet-mapping>


I am trying to run the code on IntelliJ and here is how I have configured my tomcar server on IntelliJ.

When I run the code, I see the page is generating the jsp as expected.

What I don't understand is how to configure the submit with onclick so that I click on submit and the java program in the backed triggers. I have written the java code just to read values from a database by taking the input from the method process. This was running fine and I was asked to take the input from JSP and display the result back on a JSP. 
When I click on submit button, I don't see any progress in the console output. I guess I didn't map it correctly. 
Most of the links online contain JSP & JAVA together which is even more confusing.
Could anyone let me know how can I trigger the program by clicking the submit button

A: Since you are using @WebServlet, you do not need mapping in web.xml. Just add the following line inside body of your JSP:
<form action="getdata.do" method="post">


A: Look at your JSP file, pay attention at your head and body tag. I think it's a wrong that you have body inside other body and closing head tag inside body. 
Other case that can be more important that to send a form by clicking to submit button you should put it inside tag form, something like this.


  <form action = "getdata.do" method = "POST">
     First Name: <input type = "text" name = "first_name">
     <br />
     Last Name: <input type = "text" name = "last_name" />
     <input type = "submit" value = "Submit" />
  </form>



