Developing a simple Java web application using Eclipse and Apache Tomcat - Part 1

by Steve Ochani http://www.steveo.us

v 1.0 April 26th, 2010.

Purpose: To show how to make a simple web application in Java using Eclipse and the Apache Tomcat java servlet container/application server. This tutorial will show you how to setup Eclipse to use Apache Tomcat on your local computer for testing and how to make the actual web application. This first application is very simple; it gets the user's name and say hello to the user.

Intended audience: This tutorial is mainly intended for students taking ITE 204 (Java Programming) course at SUNY Nassau Community College but is still relevant to anyone wishing to develop a J2EE web application in Java. You should have at least basic knowledge and understanding of object oriented programming concepts in Java and know how to use Eclipse.

Structure of this document: This tutorial is split up into easy steps each containing text and thumbnails of screenshots. You can click on the thumbnail to see the full size screenshot (except the very first one).

Pre-requisite: Download and unzip Apache Tomcat 6 from either from Apache Tomcat's website (get the zipped version) or http://stargate.ncc.edu/tomcat/. I then recommend you unzip Tomcat into the same drive where you put your Eclipse workspace, for example J:\ (for people working on the college network)

 

1. Launch Eclipse and make sure it's in Java EE perspective. You can either click the Java EE perspective mode button on the top right or go to the Window menu, click Open Perspective and select Java EE. (for your regular Java apps. you will have to put the regular Java perspective back)

 

2. Now the first thing to do is set up Eclipse to use Apache Tomcat that you downloaded and unzipped. Go the File menu, select other.

 

3. In the new item wizard, select Server and click Next.

 

4. In the Apache list select "Tomcat 6.0 Server" then click Next.

 

 

 

 

Page 2