Hi 'm new to servlets. Just know that there are methods named doXXX() and getXXX() Could somebody tell me which case we use doGet() and in which we use doPost(). One more method, service is availbale. If suppose I send a 'get' request, which methods will be called? in which sequence
Well, the names of the methods giveaway what should they be used for. doGet() for implementing GET request (for eg. clicking on a URL) and doPost() for POST requests (for eg. submitting a form). You don't need to implement service(...) methods. GenericServlet and its subclass HttpServlet (from which you'll extend your servlet) implement them appropriately. The servlet container calls service(ServletRequest, ServletResponse). This method calls service(HttpServletRequest, HttpServletResponse), whic(implemented in HttpServlet), determines the request type (GET, POST, etc) and calls the respective method. HTH, Paul.