JSP using NetBeans IDE

JSP Web Application Development using NetBeans IDE

In this article, I am going to show you the step-by-step process to create and run the JSP Web Application using the NetBeans IDE. Please read our previous article where discussed JSP Web Application Development using the MyEclipse IDE. NetBeans IDE lets you quickly and easily develop Java desktop, mobile, and web applications, as well as HTML5 applications with HTML, JavaScript, and CSS. The IDE also provides a great set of tools for PHP and C/C++ developers.

Download NetBeans IDE from https://netbeans.org/downloads/6.1/index.html

JSP Web Application Development using NetBeans IDE:

In this, we will create a simple JSP file and run it on NetBeans IDE using Apache Tomcat Server. Follow the below steps to create the servlet in the NetBeans IDE:

Step-1: Create New Project

Open NetBeans IDE and then select File -> New Project option from the context menu as shown in the below image.

Create New Project using NetBeans IDE

It will open the New Project window. From this window, select Java web -> Web Application and then click on the Next button as shown in the below image.

Create New JSP Project using NetBeans IDE

Once you click on the Next button, a new window is generated with a default project name. Now change the project name to “HelloWorldJSP” and select the location where you want to create the project and then click on the “Next” button as shown in the below image.

JSP Web Application Development using NetBeans IDE

Once you click on the Next button, a new window is generated for the server and setting the wizard. First, go to the server and click on “Add server”. Since I already set up the Tomcat Server, it is shown there but when you do it the first time it shows blank. And then click on the “Next” button as shown in the below image.

JSP Web Application using NetBeans IDE

After clicking on Add, a list of servers opens. In this article, I used Tomcat Server 7.0.40. Choose your server and configure it. For Tomcat Server choose it and click on “Next”.

JSP Web Application using NetBeans IDE

Now a window opens asking for the server location. Now, click on the Browse button and find the server location where you have stored the Apache Tomcat. Note that you need to provide the path up to the bin directory of Tomcat Server.

After providing the server path you will see two more options for username and password. It’s your choice whether you want your username and password or you want the default created by the Netbeans IDE. Now click on “Finish”.

JSP using NetBeans IDE

Now a window is generated containing the default index.html file in Web Pages under HelloWorldJSP. 

Step-2: Creating JSP Page

In order to create a JSP Page, right-click on your project, and then select New -> JSP option as shown in the below image.

Creating JSP Page using NetBeans IDE

It will open the New JSP window. Here, give the File Name as “HelloWorld” and then click on the “Finish” button as shown below.

Creating JSP Page using NetBeans IDE

Once you click on the “Finish” button a JSP page will create automatically where edit the following code and save it (Ctrl+S).

Creating JSP Page using NetBeans IDE

For changing the port number for your server, go to service right click on Apache Tomcat -> Properties

JSP Web Application Development using NetBeans IDE

Change the port number and click on the “close” button as shown in the below image.

JSP Web Application Development using NetBeans IDE

Step-3: Run your Project

For running your project right-click on the project and select “Run” as follows.

Run JSP Project using NetBeans IDE

The following output is generated through the specified JSP file.

Run JSP Project using NetBeans

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

Leave a Reply

Your email address will not be published.