Technologies used in this article :

  1. Eclipse 3.7

  2. Tomcat

Eclipse Installer : Download from Eclipse 3.7
Tomcat Installer : Download from Tomcat 7

 

1. Create Dynamic Web Project

Select from the menu File --> New --> Dynamic Web Project.

Create Dynamic Web Project

Enter "HelloWorldJSP" as the project name. Keep rest of the settings as it is as shown in the following screenshot.

Enter project name

Click "Next" button.

Configure project

Click "Next" button.

Configure web module setting

Check 'Generate web.xml deployment descriptor' checkbox and click "Finish" button and Eclipse IDE will generate the web project automatically as shown below

Generated web project

 

2. Create Jsp page

Right click on 'WebContent' folder and select from context menu New --> Jsp File.

Create Jsp page

Write "helloWorld.jsp" in the 'File Name' field and Click "Finish" button.

Create new jsp file

Eclipse will generate a jsp page and open the same in the JSP editor as shown below

File: helloWorld.jsp

 

4. Write JSP Code

Edit the generated 'helloWorld.jsp' as per the following code.

File: helloWorld.jsp

 

5. Run Your Code

Right click on 'helloWorld.jsp' and select from context menu 'Run As' --> 'Run on Server'.

Run on Server

Select the existing tomcat server. If not available then manually define a new web server.

Run on Server

Click "Finish" button. HelloWorldJSP web application will be deployed in the tomcat web server.

Console Output

 

6. Browser Output

Eclipse will open a browser and your server side jsp code will print 'Hello World!' in the browser.

Browser Output

 

Download Source Code

SrcCodes : HelloWorldJSP.zip

 

References