Servlet program using Eclipse IDE.

Hello Friends,

This tutorial is regarding development of Servlet program using Eclipse IDE. Eclipse IDE is very popularly used for development of various web based and java applications. Servlet applications are very easily developed using the eclipse IDE. Following are the simple steps for the same.

Step 1) Open the Eclipse IDE and set the Perspective to Java EE (if not set by default).

Step 2) Create a new Project from File -> New -> Dynamic Web project.

Step3) Enter the details for the project for e.g. Project Name, Target runtime, Configuration etc. For now, we can concentrate on Project Name and target Runtime. Target Runtime is used to set the runtime environment for your servlet programs. In this tutorial we will set up the Apache Tomcat server for running our application.

Step 4) Setting up the Target Runtime: Click the New Runtime button and select the tomcat version you have installed. Then click on Next.

Step 5) Now, browse to the tomcat lib folder path and click on finish. Also finish the Project creation wizard.

Step 6) At this stage the Project is created in eclipse. Now right click on the project and create new Servlet.

Step 7) Enter the details for your servlet file and click finish.

Add below lines in the doGet() function and save it:-

Then Right click on the project or code snippet and click Run As -> Run On Server. The server will start by itself and will run the program for you, if there is no error then the output will be printed.

Check the output 🙂

Hope this will help you. Please write your reviews at admin@code2java.com

Regards,

Nikhil Naoghare.

3 thoughts on “Servlet program using Eclipse IDE.”

    1. Hi Vishal,
      I guess you have not installed the apache tomcat properly. What kind of error you are getting, please mention that.

      Thanks.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.