Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Why we should not override service() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Why we should not override service() ?" Watch "Why we should not override service() ?" New topic
Author

Why we should not override service() ?

Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 422
Hi, Why all of us are writing doGet() or doPost() methods in our servlet classes instead of just service() method ?
What I am saying is, We can still keep get or post in the HTML along with service() method in Servlet class. I don't see any difference between above 2 lines. HFSJ Page 99 says that We should not override service() method. Why ??


OCPJP 6.0-81% | Preparing for OCWCD
http://www.certpal.com/blogs/cert-articles | http://sites.google.com/site/mostlyjava/scwcd |
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41069
    
  43
See this FAQ: http://www.coderanch.com/how-to/java/ServletsFaq#overriding-service

Actually, you should go through the entire Servlet FAQ; it answers a lot of the question you posted.


Ping & DNS - my free Android networking tools app
 
 
subject: Why we should not override service() ?
 
Similar Threads
Why is the Service() method in the servlet not overriden?
About servlet's service() method
Service method
why we should not override service() method in a servlet
Why service() cannot be overridden??