How to create a Servlet with Eclipse and Tomcat server
- JDK 7 (Java SE 7)
- Eclipse JUNO IDE
- Apache Tomcat 7.x
- Servlet 3
Setting up development environment
To install Eclipse IDE and to configure Apache Tomcat read this page
Creating Dynamic Web Project
Start your Eclipse and then go with File > New > Dynamic Web Project and enter project name as HelloWorldServlet and set rest of the options as given in the following screen:
You will see the Dynamic web project in the ‘Project Explorer’ view.
Right click on src or Project -> New -> Servlet
- Enter the Java package name as com.servlets
- Enter the Class name as HelloWorldServlet
- Click on ‘Finish’
Thats all on how to create a servlet in eclipse, in our next article we shall learn to implement Hello world example using Servlet.