Important note:  Anytime you recompile any java class that is part of your application, you must re-start Tomcat!

The minimum code for creating a servlet is:
[
][
]
import javax.servlet.*;
import javax.servlet.http.*;

public class MinimalServlet extends HttpServlet {

   public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
      // code to process when form method is GET
   }

   public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
      // code to process when form method is POST
   }

}
[
][
] Often, the code for a GET and POST is the same. Some programmers will place the code in one method, then call that method from the other. I like to create a "process" method for the code, then have the "doGet" and "doPost" call the "process" method. The code for my servlet can be viewed here: CIS237Servlet.java. In my "process" method, I am testing the value of a hidden field in the form. This tells me what process to execute. Then, I have a separate method that is called for each process. Each process method returns a String indication the page the should be re-directed to.