Servlet Example


Steps to create a Servlet Example

There are 6 steps to create a servlet instance. These steps are required for all of the servers.

The servlet instance may be created through 3 ways:

  1. By enforcing Servlet interface,
  2. By inheriting GenericServlet class, (or)
  3. By inheriting HttpServlet class

The ordinarily used technique is through extending HttpServlet as it offers a http request unique approach inclusive of doGet(), doPost(), doHead() etc.

Here, we're going to use apache tomcat server on this instance. Below the steps are given:

  • Make a listing structure
  • Make a Servlet
  • Compile the Servlet
  • Make a deployment descriptor
  • Start the server and installation the project
  • Access the servlet