March 17th, 2023
Servlet basics

Servlet is created using these 3 methods:

  • extends HttpServlet
  • implement Servlet
  • extends GenericServlet
 
 
Container is available inside of the server.
Container is the runtime environment of any component. Servlets run inside the Container.
 
Servlet lifecycle methods
  • init
  • service
  • destroy
web.xml also called Deployment Descriptor

Forward the response and request to other servlets

				
					RequestDispatcher rd = request.getRequestDispatcher("MyConfigDemo");
				rd.forward(request, response);
				
			
Home folder
				
					String dir = System.getProperty("user.dir");
System.out.println("Dir: "+ dir);
//Dir: /home/soundarya
				
			

Leave a Reply

Your email address will not be published. Required fields are marked *