Before going for differences, first let us see how the three Servlet, Observe the hierarchy and understand the relationship between the three. The main difference between GenericServlet and HttpServlet is that the GenericServlet is protocol independent and can be used with any. hi whats the main difference between Generic & httServlet??.
|Published (Last):||18 August 2013|
|PDF File Size:||6.87 Mb|
|ePub File Size:||12.47 Mb|
|Price:||Free* [*Free Regsitration Required]|
It is developed by Apache Software Foundation. Anonymous 11 June at Bhupendra Dixit 8 May at GenericServlet also implements the log method, declared in the ServletContext interface.
All classes, interfaces, and methods present in the javax. Object, and implements Servlet, ServletConfig, and, java.
Generic servlet has abstract method service ,http servlet is a sub class of generic servlet,so http servlet also contains abstract method service. Servlet Interface to handle a servlet work. HttpServlet gives a blueprint for Http generifservlet and makes writing them easier. Anoushka Sakthi 26 November at However, public abstract class HttpServlet extends and, GenericServlet implements java.
Servlet is a Java technology that helps to develop scalable and robust web applications.
Sign up or log in Sign up using Google. VJosh 6 December at Umesh Prajapati 19 October at It has a series of articles related to Java technologies.
difference between genericServlet & httpServlet (Servlets forum at Coderanch)
GenericServlet gives a blueprint and makes writing servlet easier. In HttpServlet it is possible to define separate logic for get and post request.
Used with Servlets only. What is single thread model and multi thread model in servlet?
Servlet vs GenericServlet vs HttpServlet
One vifference feature is both the classes are abstract classes. Anonymous 14 April at Use doPost, doGet method instead of service method. It is abstract, so it is not to be directly instantiated. It is a special type of Servlet which is actually a pretty minimal interface.
GenericServlet makes writing servlets easier. Rajnish Jha 18 December at With HttpServlet extension, service method can be replaced by doGet or doPost with the same parameters of service method. It is a platform-independent server-side component.
Email Required, but never shown. So, if you extend HttpServlet, you can get the functionality of both. It is the immediate subclass of Servlet interface.
It provides simple versions of the lifecycle methods init and destroy and of the methods in the ServletConfig interface. Did you read it? Servlet is a server-side web technology. GenericServlet is the immediate subclass of Servlet interface.
To write a servlet, everyone goes to extend the abstract class HttpServletlike Frame is required to extend to create a frame. The minus point of the first way is, all the 5 abstract methods of the interface Servlet should betewen overridden eventhough Programmer is not interested in all like the interface WindowListener to close the frame. Most likely you only have to care about this one.
Object implements Servlet, ServletConfig, java.