Back to: JSP Tutorials for Beginners and Professionals
JSP Web Application Development using NetBeans IDE
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.
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.
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.
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.
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”.
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”.
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.
It will open the New JSP window. Here, give the File Name as “HelloWorld” and then click on the “Finish” button as shown below.
Once you click on the “Finish” button a JSP page will create automatically where edit the following code and save it (Ctrl+S).
For changing the port number for your server, go to service right click on Apache Tomcat -> Properties
Change the port number and click on the “close” button as shown in the below image.
Step-3: Run your Project
For running your project right-click on the project and select “Run” as follows.
The following output is generated through the specified JSP file.
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.