Java Servlets Introduction Tutorial

 

Java Servlets Introduction Tutorial


coding-zon-java-servlets--introduction-tutorial

Servlets Home

 In a Java Web Application to communicate with server we need servlets. Servlet receives user request and send response. In this tutorial, you are going to learn, All about  Java Servlets and their types and its lifecycle methods.

 

 Table of Contents

  1. Introduction to Servlets
  2. Servlet life cycle
  3. Servlets Hierarchy
  4. Servlet Interfaces
  5. Servlet Classes
  6. HTTPServlet Package

 

 Introduction to Servlets

Servlets run at server. i.e., they are server side programs which serves to client request.  One servlet can serve to multiple requests. When request  made to particular servlet It is loaded in memory and initialized and next It will serve the request. If it is no longer required, it is destroyed from memory.

Servlet life cycle

  • init
  • service
  • destroy

All the servlet built-in classes are available in a package called. To create a servlet, you need to import the following package.

javax.servlet Package
 

TOP Menu

Servlets Hierarchy

The below image depicts the hierarchy of the servlets.

 

codingzon-servlet-hierarchy

Servlet Interfaces


  • Servlet 
  • ServletConfing 
  • ServletContext 
  • ServletRequest 
  • ServletResponse

Menu


Servlet Classes

  • GenericServlet 
  • ServletInputStream
  • ServletOutputStream 
  • ServletException

javax.servlet.http Package


  • HttpServletRequest.
  • HttpServletResponse.
  • HttpSession.
  • HttpSessionBindingListener.
  • HttpCookie.
  • HttpServletEvent.
  • HttpServletSessionBindingEvent.

Comments

Popular posts from this blog

Using javascript pass form variables to iframe src

Creating a new PDF by Merging PDF documents using TCPDF

Import excel file into mysql in PHP