Sunday, March 29, 2020

Difference Betwixt Genericservlet Vs Httpservlet Inwards Servlet Jsp - J2ee Question

Difference betwixt GenericServlet together with HttpServlet is 1 of the classic Servlet Interview Question, asked on many Servlet together with JSP Interviews on ii to four years sense developers. Since both GenericServlet together with HttpServlet forms footing of Servlets its of import to know What are they together with What is principal divergence betwixt them. From mutual sense together with at that spot names, its obvious that GenericServlet is a generic together with protocol independent implementation of Servlet interface piece HttpServlet implements HTTP protocol specifics. If you lot are working inwards Java spider web application or J2EE projects, you lot are around probable to bargain amongst HttpServlet all fourth dimension every bit HTTP is principal communication protocol of web. In this Servlet JSP article nosotros volition outline around of import difference betwixt HttpServlet together with GenericServlet which is worth knowing together with remembering.

GenericServlet vs HttpServlet

Here is my listing of divergence betwixt HttpServlet together with GenericServlet inwards Java Servlet API :

1) GenericServlet provides abstract service(ServletRequest, ServletResponse) method to implement which gets called past times container whenever it receives asking for processing, On the other manus HttpServlet overrides service method together with provides callback on doGet(HttpServletRequest request, HttpServletResponse) together with doPost(HttpServletRequest request, HttpServletResponse response) whenever it receives HTTP asking from GET or POST method. It too provides several other method based upon diverse HTTP methods of sending asking e.g. doPut() or doDelete() to conduct maintain HTTP PUT together with HTTP DELETE request.



2) Another difference betwixt GenericServlet together with HttpServlet is that afterward is a subclass of GenericServlet together with inherit properties of GenericServlet.

3) Generic servlet provides a rather easier agency to extend Servlet, its plenty to override service method to implement GenericServlet. Apart from extending Servlet interface, it too implements ServletConfig interface together with provides agency to stimulate got initialization parameter passed to Servlet from web.xml e.g. past times using getInitParamter().

 forms footing of Servlets its of import to know What are they together with What is principal divergence b Difference betwixt GenericServlet vs HttpServlet inwards Servlet JSP - J2EE question
That's all on difference betwixt GenericServlet together with HttpServlet inwards Servlet API. Its real rare you lot are going to run GenericServlet simply its practiced to know basics every bit its generally asked inwards diverse Servlet interviews every bit well. HttpServlet is primary Servlet flat which is used inwards Java spider web application from treatment customer request.

Further Learning
Difference betwixt URL Encoding together with URL rewriting

No comments:

Post a Comment