Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Small doubt on servlets class

 
Supriya Nimakuri
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the relation between GenericSerlet and HttpServlet.

Is GenricServlet the super class for HttpServlet..

Question 2:

What is the role of initialization in Servlet life cycle. what actually it initializes.

Regards..
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is GenricServlet the super class for HttpServlet..
Yes; GenericServlet is a protocol-independent implementation of Servlet, basially providing storage of the ServletConfig and a new init() method for convenience. HttpServlet takes this one step further, and adds the convenient doXxx() methods. You can extend either (or implement Servlet directly) to create a servlet, but using HttpServlet as a base class is most common.
What is the role of initialization in Servlet life cycle. what actually it initializes.
Initialisation is a stage in the servlet's life invoked by the container. The servlet can use the initialisation stage to manage any start-up conditions, such as extracting initialisation parameters from the ServletConfig, or perhaps opening connections to persistent data stores (you must however be careful about multi-threading if you do this). It isn't that the servlet is initialising anything else, but rather that the servlet itself is being initialised.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic