![]() |
|
| Servlets Servlets Interview Questions asked in various Interviews. Professionals are invited to share Answers for these Servlets Interview Questions. Servlets Interview Questions with answers, Experiences, Career Advices, Tips and more. |
![]() |
| LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Senior Member Join Date: Apr 2008
Posts: 13,341
Thanks: 0
Thanked 18 Times in 18 Posts
Rep Power: 136 | What is Generic Servlet and how What is Generic Servlet and how it is different from Http Servlet? |
| | |
| | #2 (permalink) |
| Junior Member Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 | Re: What is Generic Servlet and how Generic servlet is the class which implements servelt interface directly.This is not particualr for one protocol.If we want to design our own servelt whcih not particular any protocol we can extend this class. Httpservlet is the child class of Generic servlet.it is particular to HTTP protcol.If we want to design HTTP based servlet we can extend the Httpservelt class. |
| | |
| | #3 (permalink) |
| Junior Member Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4 | Re: What is Generic Servlet and how and also generic servlet is abstract class in which service method is not implemented,but in Httpservelt all the methods are implemented but again it is declared as abstract.To avoid object creation for HTTPservlet class ,this class declared as abstract.As methods defined in HTTPservlet class is for generation of error information.So object creation for this class will not make sense.we can extend this class and override methods for generating our required o/p in ourservlet class. |
| | |
| | #4 (permalink) |
| Senior Member Join Date: Feb 2008
Posts: 147
Thanks: 15
Thanked 71 Times in 46 Posts
Rep Power: 10 | Re: What is Generic Servlet and how Generic servlet is protocal independent cannot support cookies httpsession and url writing it does not send large data Http servlet sends large data and its protocol independent support cookies sessions. HttpServlet is used to handle only http request & response but whereas Generic servlet can be used to handle any type of requests and responses , such as FTP... The other difference which we can fine between both of them is.. A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract Generic servlet doesn’t maintain client session where as httpservlet maintains session. Generic servlet is the servlet which serves all kind of request but http servlet serves only http servlet. So the later one is protocol dependent. as part of javax.servlet a class Generic servlet is provided.this class implements the servlet interface,in this class service() is declared as abstract and this class contains the code that is not specific to any protocol as part of javax.servlet.http a class HttpServlet is provided, this class is sub class of GenericServlet.this class implements the servlet interface and service() is not declared as abstract and this class contains the code that is specific to http protocol |
| | |
![]() |
| Tags |
| generic , interview questions , servlet , servlets |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| More Interview Questions Here... |