Posts

Showing posts from July, 2020

Complete Servlet notes Day-3

Image
Types of web container: 1. Stand-Alone web container 2. In-Process container 3. Out-Process container Stand alone web container: > This type of container application and server application both are running in same memory space. Servlet Life Cycle Methods: > There are five methods are available inside Servlet interface a. init() b. service() c. destroy() d. getServletConfig() e. getServletInfo() > Out of five methods there are three methods are part of servlet life cycle   a. init()   b. service()   c. destroy()   init(): > public void init(ServletConfig cofig)throws SE > After instantiating Servlet class init() method implicitly invoked by the web container jus after execution of constructor block. > For any servlet object init() method will be executed only once. Which type of logic should be placed inside init() method? > If you want to execute any logics exactly once for each servlet object then such type of logics should be placed inside init...

Complete servlet Notes Day-2

Image
New App create: Example:  filename: LifeCycleServlet.java ---------------------------------------- import javax.servlet.*; public class LifeCycleServlet implements Servlet{   public LifeCycleServlet(){   }   init();   service();   destroy();   getServletConfig();   getServletInfo(); } Website: Example application illustrating servlet life cycle methods. Appname: lifecycleapp       +     |     +--- WEB-INF       |       |       +- classes       |       +       |      LifeCycleServelt.java       |      LifeCycleServlet.class       +- web.xml > e: e:\>cd servlet e:\servlet>cd f4 e:\servlet\f4> md lifecycleapp e:\servlet\f4\lifecycleapp>md WEB-INF e:\servlet\f4\lifecycleapp>cd WEB-INF e:\servlet\f4\lifecycleapp...