Q)Explain about the instantiation phase of a servlet? =>Servlet Container creating the object of the servlet class is nothing but the instantiation phase of the servlet. =>When a request for a servlet is received for the first time, Servlet Container creates the instance(object) of the servlet class. =>Servlet instance is created only once. That single instance only serves all the clients requests. Q)Explain about initialization phase of a servlet? =>Servlet Container calling the init method of the servlet is nothing but the initialization phase of the servlet. =>Servlet Container calls init method only once in the life time of a servlet. =>During the instantiation phase, servlet instance is there but it doesn't posses servletness to serve the client request. =>Once init method of the servlet is completely executed, it is ready to serve the client request. =>Web application developer writes code in init method to provide resources to the servlet. For eg. database connection creation creating the PreparedStatement object etc. Q)Explain about servicing phase of the servlet. =>Servlet Container calling the service method of the servlet is nothing but the servicing phase of the servlet. =>For each client request, service method is called once. =>After serving one client request, the servlet instance waits for another client request. Q)Explain about destruction phase of a servlet. =>Servlet Container calling the destroy method of the servlet is nothing but its destruction phase. =>Servlet Container calls destroy method on the servlet only once. I.e. In the life time of the servlet destroy method is called only once. =>When the application is unloaded or the server is shutdown, Servlet Container container calls the destroy method. =>Resources releasing for eg. closing the PreparedStatement, closing the Connection is done in destroy method. =>After calling detroy method, servlet container marks the servlet instance for garbage collection. Q)What are the steps involved in Java web application development? Step 1:- Creating a structured hierarchy of directories Step 2:- Developing all the web resources of the application. Step 3:- Deployment descriptor development (web.xml) Step 4:- Configure the application files. Creating the structured hierarchy of directories ------------------------------------------------------ =>Create a root folder with any name. =>Within this folder, create another folder WEB-INF =>Within WEB-INF folder, create 3 folders. 1)src 2)classes 3)lib Developing the web resources ---------------------------------- =>What ever static resources and dynamic resources required in the application, develop all of them. Deployment descriptor development ------------------------------------------ =>Develop an xml file "web.xml" Configuring the application files ------------------------------------ =>Copying the application files into appropriate folders is nothing but configuring the application files. =>html files, css files, js files, image files etc. copy into root folder. =>Java files copy into "src" folder =>All ".class" files are to be copied into "classes" folder =>Any jar files(for eg. JDBC driver jar file) copy into "lib" folder =>Copy web.xml into WEB-INF