Skip to content

Latest commit

 

History

History
20 lines (20 loc) · 1.14 KB

File metadata and controls

20 lines (20 loc) · 1.14 KB

Let's see the steps, you need to follow to create the first servlet example.

  • Create a Dynamic web project
  • create a servlet
  • add servlet-api.jar file
  • Run the servlet
  1. Create the dynamic web project: For creating a dynamic web project click on
    File Menu -> New -> Dynamic web project -> write your project name e.g. first -> Finish.
  2. Create the servlet in eclipse IDE: For creating a servlet, explore the project by
    clicking the + icon -> explore the Java Resources -> right click on project or application -> New -> servlet -> write your servlet name
    e.g. Hello -> uncheck all the checkboxes except doGet() -> next -> Finish.
  3. Add jar file in eclipse IDE: For adding a jar file,
    Right click on your project -> Build Path -> Configure Build Path -> click on Libraries tab in Java Build Path -> click on Add External JARs button -> select the servlet-api.jar file under tomcat/lib -> ok.
  4. Start the server and deploy the project: For starting the server and deploying the project in one step
    Right click on your project -> Run As -> Run on Server -> choose tomcat server -> next -> addAll -> finish.