I have some doubt in ServletModel. How the Servlet get instantiated ? we all know that it first call init() method, then service method() & destroy(). How the service() is mapped to corresponding GET or POST. so for HttpServlet is this flow ???
The latter, really. The container implements the service method so that it calls the appropriate doXXX method. The service method should never be overriden.
But which service() method it calls. service(ServletRequest req,ServletResponse res) or service(HttpServletRequest req,HttpServletResponse res) Thanks & Regards Mike
Upon receiving a request, the servlet container/engine first calls the service(ServletRequest req,ServletResponse res) method of the servlet. Then the service(ServletRequest req,ServletResponse res) method will call the service (HttpServletRequestreq,HttpServletResponse res) method. The service (HttpServletRequestreq,HttpServletResponse res) method will then analyze the request and call the appropriate doXXX() method. This is the flow of control from the servlet container/engine to the doXXX() methods as defined in the HttpServlet javadoc and the SCWCD Exam Kit book. Hope that was helpfull, Andreas
=========================<br />SCJP2 (Passed with 89%)<br />SCJP2 (Passed with 93%)<br />Preparing for SCBCD<br />=========================
"Tomcat" is the reference implementation of the Servlet and JSP APIs. If you are unsure of the meaning of the specification in any area, then you can look at the Tomcat source code to see what it does and how it does it. In all but some pretty obscure places it can be treated as a definitive implementation. By the time you find the differences, you'll have enough understanding that you can read and argue about the specification directly.
Hello, The reply from Andreas is fully comprehensive. The servlet cotainer calls the generic service method which delegates the call to the http-specific service method by type-casting the arguments in HttpServlet. This method calls the req.getMethod() to determine the doXXX() method. Rajesh Kumar
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth