Http Servlet Service method
1 posts in topic
Flat View  Flat View

Posted By:   Makarand_Parab
Posted On:   Wednesday, February 6, 2002 09:30 PM


Hi all

The Servlet API says that in HTTP
Servlet the service method dispatches the request to doXXX() method.
My question is can i override service method in servlet class which extends HTTPServlet.

Is that for a servlet class which extends HTTPServlet will the request first go to service method always and then it will be dispatched to doXXX() method.

Can somebody clarify on this
Thanks in advance

Makarand Parab

Re: Http Servlet Service method

Posted By:   Bozidar_Dangubic  
Posted On:   Thursday, February 7, 2002 07:43 AM

if you do not override the service() method it will be dispatched to doGet(), doPost() .... if you override it, you are on your own. if you want to forward, then you forward. basically it is a matter of where you want to put your code, service() or doXXX() methods. if you put the code in doXXX() methods, service() will forward request to it. if you override, then your code is in service() and question of whether the request should be forwarded elsewhere or not is in your hands. You could forward but you could also put all your logic in service(). different people prefer different implementations. some override service() some provide doXXX()s and leave the service() alone. pick your poison ...
About | Sitemap | Contact