I wrote a servlet to handle both POST and GET requests, based on the example given here. I have the following:
A html with the following form:
form method="POST" action="servlet/RequestType"
and input:
input type="submit" value="POST"
The following doGet and doPost methods:
public void doGet(HttpServletRequest req, HttpServletResponse rsp)   throws ServletException, IOException {
    rsp.setContentType("text/html");
    PrintWriter out = rsp.getWriter();
    String requestType = req.getMethod();
    out.println("<html>");
    out.println("<head><title> Request Type: " + requestType
       + " </title></head>");
    out.println("<body>");
    out.println("<p>This page is the result of a " + requestType
    + " request.</p>");
    out.println("</body></html>");
}
public void doPost(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
    doGet(req, rsp);
}
The output should be:
This page is the result of a POST request.
But I'm getting:
This page is the result of a GET request.
Does anyone know why this might be happening?