Introduction

In this article we discuss how to create JSP in an Eclipse IDE with Tomcat Server.

To create JSP in Eclipse we must do the following 3 main steps:

  1. Start by creating a dynamic web project.
  2. Create a JSP.
  3. Last and finally, start the Tomcat Server and deploy the project.

Step 1

Start creating dynamic web project

Step 1(a)

To create a dynamic web project, open the Eclipse IDE.

Fig-1.jpg

Step 1(b)

Now, click on file menu and select "New" then select dynamic web project as in the following.

fig-2.jpg

Step 1(c)

Now a window appears asking for the project name; give our project name there, for example webfirst, then click on either "Next" (then again "Next") or directly click on "Finish".

fig-3.jpg

Now a window is generated containing our webfirst project file, as in the following:

fig-4.jpg

Step 2

Now create a JSP file.

Step 2(a)

To create a JSP file explore the project by clicking on the "+" icon then right-click on WebContent.

fig-5.jpg

Step 2(b)

Now click on "New" then choose JSP file as in the following.

fig-6.jpg

Step 2(c)

Now write our JSP file name, for example "welcome":

fig-7.jpg

Step 2(c)

Now click on "Next" then "Finish". Now our JSP file is cretaed, let's write some code here, as in the following:

fig-8.jpg

Step 3

Now finally start the server and run our project

Step 3(a)

First right-click on our project, choose "Run" then choose "Run on server" as in the following:

fig-9.jpg

Step 3(b)

Now choose Tomcat Server and then click on "Finish".

fig-10.jpg

We see that JSP is successfully running now.

fig-11.jpg