Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Servlet or Web Servlet :-

                                                                                                                                              Next Chapter

It is a predefined Java Class that will be inherited by javax.http.servlet package. This class will be compiled by Java Compiler and execute by JVM under  Servlet container by Web Server.

A Servlet container is used to manage the dynamic functionality of an application, Webserver is only used to manage static files (HTML, JS, CSS, Jquery) but dynamic content will be managed by Servlet Container itself.







hence It is also called Web-based Java class.

Servlet Class will be executed under Servlet container to Web Server.

Servlet class Managed By HttpServlet  Class in Java

class A extends HttpServlet
{
   public void init()
  {

   }
    public void doGet(HttpServletRequest request,HttpServletResponse response)   //For HttpGet
   {


   }

  public void doPost(HttpServletRequest request,HttpServletResponse response)   // For HttpPost
  {


  }


public void destroy()
{

}
}


Servlet Life Cycle:-



Servlet Use Four Different State to Perform Operation

1)  Loading:- When we call Servlet class then the servlet object will be loaded under Web Container.


2) Initializing:-  After Successfully loading the servlet object data will be initialized under memory and call init();


3)  Handling Request:-  When we request a servlet from client to server then it will check the service method if it gets then doGet() will be called otherwise doPost() will be called.


4) Destroy:-  This method will be called implicit when the servlet objects will be destroyed.




                                                                                                                                        Next Chapter


Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post