Answers

Question and Answer:

  Home  Sr.Java Web Developer

⟩ Explain me what is a servlet?

☛ Java Servlet is server side technologies to extend the capability of web servers by providing support for dynamic response and data persistence.

☛ The javax.servlet and javax.servlet.http packages provide interfaces and classes for writing our own servlets.

☛ All servlets must implement the javax.servlet.Servlet interface, which defines servlet lifecycle methods. When implementing a generic service, we can extend the GenericServlet class provided with the Java Servlet API. The HttpServlet class provides methods, such as doGet() and doPost(), for handling HTTP-specific services.

☛ Most of the times, web applications are accessed using HTTP protocol and thats why we mostly extend HttpServlet class. Servlet API hierarchy is shown in below image.

 174 views

More Questions for you: