Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Servlets%20Interview%20Questions%20and%20Answers

Question: What's the difference between GenericServlet and HttpServlet?
Answer: HttpServlet class extends GenericServlet class which is an abstract class to provide HTTP protocol-specific functionalities. Most of the java application developers extend HttpServlet class as it provides more HTTP protocol-specific functionalities. You can see in HttpServlet class doGet (), doPOst () methods which are more targeted towards HTTP protocol specific functionalities. For instance we can inherit from GenericServlet class to make something like MobileServlet. So GenericServlet class should be used when we want to write protocol specific implementation which is not available. But when we know we are making an internet application where HTTP is the major protocol its better to use HttpServlet.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook