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:
- Start by creating a dynamic web project.
- Create a JSP.
- 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.
Step 1(b)
Now, click on file menu and select "New" then select dynamic web project as in the following.
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".
Now a window is generated containing our webfirst project file, as in the following:
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.
Step 2(b)
Now click on "New" then choose JSP file as in the following.
Step 2(c)
Now write our JSP file name, for example "welcome":
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:
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:
Step 3(b)
Now choose Tomcat Server and then click on "Finish".
We see that JSP is successfully running now.