File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Why we should not override service() ?

Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 423
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 | |
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
See this FAQ:

Actually, you should go through the entire Servlet FAQ; it answers a lot of the question you posted.
I agree. Here's the link:
subject: Why we should not override service() ?
It's not a secret anymore!