Share on Google+Share on Google+

Java httpservlet

Advertisement
HttpServlet class is an abstract class defined in "javax.servlet.http" package and is sub class of GenericServlet

Java httpservlet

     

HttpServlet class is an abstract class defined in "javax.servlet.http" package and is sub class of GenericServlet class defined in "javax.servlet" package. GenericServlet class is used to define a generic, protocol-independent servlet but HttpServlet class provides an HTTP protocol specific implementation. If your servlet has to work with HTTP protocol then your servlet needs to extend HttpServlet class. This class provides various doXXX() methods which can be overridden according to the type of request. This class also provides service() methods that can also be overridden but we don't need to do so because it calls the appropriate doXXX() method according to the method of request. Generally, doGet() or doPost() methods are needed to be overridden to handle the GET or POST requests.

 

Advertisements

Advertisement

Posted on: November 11, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Comments:0