The service method is clearly called first, altough this is transparent when using an HttpServlet. The doGet() and doPost() methods are part of the HttpServlet class. But to answer the question, (I tried it out just now) you can have an HttpServlet with all 3 methods, and the service method is called first. I am not sure when you have the service method in an HttpServlet, how the doGet or doPost is even called.
Inside the service() method of HttpServlet, it figures out which method to call, based upon the HTTP "method" property, and dispatches to the appropriate doXXX() method. If you override the service() method without calling the superclass' implementation, your servlet will NEVER call the doXXX() method, unless you specifically call it yourself. So, be careful. In general, though, you CAN override multiple doXXX() methods. One reason would be to have the doGet() method render a screen and the doPost() method handle the posting of information FROM that screen and dispatch to another servlet. That way, all of a screen's logic is in one class.
James Carman, President<br />Carman Consulting, Inc.
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad: