JSP using Eclipse IDE

JSP Web Application Development using Eclipse IDE

In this article, I am going to show you the step-by-step process to create and run the JSP Web Application using Eclipse IDE. Please read our previous article where discussed JSP Environment Setup. The Eclipse is an open-source IDE famous for our Java Integrated Development Environment (IDE), but we have a number of pretty cool IDEs, including our C/C++ IDE, JavaScript/TypeScript IDE, PHP IDE, and more. You can easily combine multiple language support and other features into any of our default packages, and the Eclipse Marketplace allows for virtually unlimited customization and extension.

Download Eclipse From https://www.eclipse.org/downloads/

JSP Web Application Development using Eclipse IDE:

In this, we will create a simple JSP file and run it on Eclipse IDE using Apache Tomcat Server. We need to follow these steps to create a servlet example:

Step-1: Create a Dynamic Web Project

Open Eclipse IDE and then Select File-> New -> Dynamic Web Project from the context menu as shown in the below image.

Create a Dynamic Web Project

It will open the New Dynamic Web Project window and from this window, you need to give the Project name as HelloWorldJSP (you can give any name as per your choice) and then select the Target runtime and finally click on the Next button as shown in the below image.

JSP Web Application Development using Eclipse IDE

Once you click on the Next button, it will open the following window where you just need to click on the Next button as shown below.

JSP Web Application using Eclipse IDE

From the next window, check the “Generate web.xml deployment descriptor” checkbox and click on the “Finish” button as shown in the below image.

JSP using Eclipse IDE

Once you click on the Finish button, the Eclipse IDE will generate the web project automatically with the following folder and file structure:

JSP Eclipse IDE

Step-2: Create JSP Page

Right-click on the “WebContent” folder and then select New -> JSP File from the context menu which will open the New JSP File window as shown in the below image.

Create JSP Page using Eclipse IDE

From the New JSP File window, give the file name as “helloWorld.jsp” in the “File Name” field and then click on the “Finish” button as shown in the below image.

Create JSP Page using Eclipse IDE

Once you click on the Finish button, Eclipse will generate a JSP Page and open the same in the JSP editor as shown below.

Create JSP Page using Eclipse IDE

Step-3: Write JSP Code

Modify the “helloWorld.jsp” as shown below:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
 pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
 <%="Hello World!"%>
</body>
</html>
Step-4: Run your JSP Code

Right-click on “helloWorld.jsp” and select Run As -> Run on Server option from the context menu as shown in the below image.

Run JSP Code using Eclipse IDE

Select the existing Tomcat server. If not available then manually define a new web server as shown in the below image.

Run JSP Code using Eclipse IDE

Once you click on the “Finish” button, the HelloWroldJSP web application will be deployed in the tomcat web server.

Step-5: Output

The eclipse will open a browser and your server-side JSP code will print “Hello world!” in the browser.

step-by-step process to create and run the JSP Web Application using MyEclipse IDE

In the next article, I am going to show you the step-by-step process to create and run the JSP Web Application using the MyEclipse IDE. Here, in this article, I try to explain the step-by-step process to create and run the JSP Web Application using Eclipse IDE. I hope you enjoy this JSP using Eclipse IDE article.

Leave a Reply

Your email address will not be published.