Pages Navigation Menu

Coding is much easier than you think

How to create a Servlet with Eclipse and Tomcat server

 

Environment Used

 

  • 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:
 
creating-dynamic-web-project-eclipse-2
 
You will see the Dynamic web project in the ‘Project Explorer’ view.
 

Creating Servlet

 
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’

 
creating-servlet-eclipse
 
Thats all on how to create a servlet in eclipse, in our next article we shall learn to implement Hello world example using Servlet.
 

About Mohaideen Jamil


Am currently working as a Struts 2 Developer in a reputed IT Organisations. I can help you with teaching Core java and Struts 2. Follow me on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.