JSP dynamic web project using Eclipse and Tomcat server

Like Tweet Pin it Share Share Email

It is quite easy to create a simple dynamic web project in JSP. JSP is being used vastly for creating dynamic web applications today.

Step by step guide to create a dynamic web application project in JSP using Eclipse IDE and Apache Tomcat web server

In this tutorial we will first create a dynamic web project in Eclipse. We will create new JSP pages. In the last we will create .war file using Eclipse. We will deploy .war file into Tomcat server and run our simple web application using Apache Tomcat server.

Prerequisites for Creating a Dynamic web Project in JSP using Eclipse IDE and Apache Tomcat is :
1. JDK 5.0 or higher version installed and configured.
2. Apache Tomcat Server Installed and Configured in your system.
3. Install or add Apache Tomcat Server in Eclipse IDE. (Step 3 of this tutorial/article)

If you run through any issue while developing first dynamic web application in JSP, please write us at info@sitenol.com

To create a dynamic web application in JSP using Eclipse and Apache Tomcat server, please follow theses steps.

Step 1: Giving Workspace Name In Eclipse
We will use eclipse ide to create JSP web application. Open your eclipse IDE. First of all, we need to create a work space. Eclipse will ask for workspace location. Workspace location is the place where all the files created in eclipse will be restored. Please provide the name of the workspace.
See the Image below for more reference. Here I have mentioned workspace name as “D:\temp\createADynamicWebProject”. You can choose any directory feasible to your system. Like you can choose “C:\createADynamicWebProject”. After giving the workspace location click on Ok.

declaring workspace in eclipse
creating a workspace using eclipse

Step 2 :Go To Workspace in Eclipse

After clicking on OK button you will receive image like eclipse_home.jpg given below. I am using Eclipse Juno. For you this image will be same if you are using eclipse juno package, if you are using different eclipse packages (Indigo, Helios, Galileo, Ganymede, Europa) other than juno then the image may be different. The action you need is click on “workspace” in the image so that we can go to eclipse development screen.

I have circled the “workspace” with red circle. I am quite sure you can find “workspace”.


Image of Eclipse showing how to go to workspace
eclipse home page

Step 3 : Configuring Application Server (Apache Tomcat Server)In Eclipse IDE

In this step I will suggest to configure Apache Tomcat Server in your eclipse IDE. Once you have configured Apache Tomcat Server, check it properly installed or not. To check Tomcat Server installed properly or not we need to start Apache Tomcat Server in Eclipse IDE. If it is failed to start we have to work with Apache Tomcat installation. If Apache has been configured correctly in your system, easily you can integrate it with Eclipse. Please see our tutorialInstalling Apache Tomcat Server In Eclipse IDE.

Image after installing/configuring Apache Tomcat Application Server in Eclipse.

image after installing apache tomcat
Eclipse image after configuring Apache Tomcat Server

Step 4 :Select “Dynamic web Project” In Eclipse
Step 3 was to discuss about Apache Tomcat installation in Eclipse. After completing step 2 we will receive Eclipse development page.
go to File > New >  Dynamic Web Project.
There select “Dynamic Web Project.”

Please see the below screen for your reference.

Image of Dynamic Project in Eclipse
select dynamic web project in eclipse – jsp dynamic web project

 Step 4 : Declare “Dynamic Web Project Details” In Eclipse

After selecting the Dynamic Web project, Eclipse will ask you to configure other parameterslike 1. Dynamic Web Project name, 2. Target Runtime, and 3. Dynamic Web Module Version. Please make sure that you are not leaving these details blank.Please See the image below.

Image showing how to set properities for Dynamic Web Application
dynamic web project jsp – declaring the dynamic web project in eclipse, apache tomcat server

1. Give the name of JSP Dynamic web project as your wish for me I have given “createADynamicWebsite”.
2. “Target runtime” is “Apache Tomcat v6.0” as I have installed Apache Tomcat 6.20 in Eclipse.
3. Dynamic Web Module Version” is 2.5.This (2.5) is the highest Web Module Version, ApacheTomcat Server 6.20 supports.
Click on finish button. After clicking On Finish Button you can see image given below.

Hello World JSP dynamic web project Eclipse Image
dynamic web project configured in eclipse

So if you can see image like this you can proceed to the next step.

Step 5 : Create One Dynamic JSP page

After this you have to create todayDate.jsp in your “WebContent” directory.
For doing this goto WebContent > New > JSP File.
Type name of your JSP page as today currentYear.jsp.


Display Today Date using JSP - A Dynamic Projcet Using JSP
Welcome to sitenol.com !
java.util.Calendar calendar = new java.util.GregorianCalendar();
out.println("<b>Current Year is (YYYY): </b>"+calendar.get(calendar.YEAR));

Please see the image How project architecture is looking in eclipse after creating this todaydate.jsp

Image is showing my first dynamic JSP Page
After setting up Dynamic Web Project using JSP – eclipse IDE and Apache Tomcat Server

Step 6 : Deploy JSP Web Application War to Apache Tomcat Server 

In this step we need to deploy our JSP web application in the Apache Tomcat Server. For this purpose we need to create a war file and we need to deploy this war file to the Apache Tomcat Server. Eclipse has inbuilt commands in it to build a war and deploy it to the Application Server configured to it.

To create war and deploying to web Server do this action –
right click on WebProject (createADynamicWebsite) > Run As > 1. Run On Server
Please see the below image for your reference.

Image shwoing deployment of JSP dynamic web application in apache tomcat server
deploying jsp dynamic web application on apache tomcat server

Go by clicking on Next button. In the last you will get the screen given below. Say Finish.

Deployment Step of War in the Tomcat Server
deployment of war to tomcat

Just after clicking on FINISH. Wait for few seconds. Please wait till Application Server starts.
Please see Console to verify that server is started or not.

Console Image for successful deployment.

This image is howing console image after successful deployment of dynamic web project in jsp using eclipse ide and apache tomcat server
JSP dynamic web application – Apache Tomcat Server installed/run successfully.

Step 7 : Run Application to See Output

Now type http://localhost:8080/createADynamicWebsite/currentYear.jsp in your browser.

You will see output with current year. I have written this post in 2013.
Output screenimage has been given below.

Running  jsp dynamic web application using eclipse ide and apache tomcat server
dynamic web project in JSP -final page

Thats all Folks! Now we have done with the Sample Dynamic Web Project using Eclipse and Apache Tomcat. Now in the same manner you can do other heavier projects with your appreciable efforts.

Please also read – How to generate missing web xml file using eclipse and manually.

Comments (1)

Leave a Reply

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