Creating Servlet using NetBeans IDE

Creating Servlet using NetBeans IDE

In this article, I am going to discuss how to use Create Java Servlet Application using NetBeans IDE. Please read our previous article where we discussed how to use Create Servlet Application using MyEclipse IDE.

how to use Create Servlet Application using NetBeans IDE?

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

Once you download and install NetBeans IDE, then open it and it will show the following window.

Creating Servlet using NetBeans IDE

In order to create a Project using NetBeans, click on File -> New Project option from the context menu as shown in the below image.

Servlet using NetBeans

It will open the following “New Project” window. Here, you need to select “WebApplication” Project templates and then click on the “Next” button as shown in the below image.

Creating Java Servlet using NetBeans IDE

Once you click on the Next button, it will open the following Name and Location window where you need to give the name and location of your project. Here, I provided the project Name as “WebApplication1” and then click on the “Next” button as shown in the below image.

Java Servlet using NetBeans

Once you click on the Next button, it will open the Server and Settings window. Here, you need to select the server, Java EE Version and Context path as shown in the below image and click on the Next button.

Creating Java Servlet Application using NetBeans IDE

Next, select the Frameworks (if any) and click on the “Finish” button. Here we are not selecting any Framework.

Java Servlet Application using NetBeans

Once you click on the Finish button, it will create the project for us.

Creating a Servlet using NetBeans:

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

Creating a Servlet using NetBeans

It will open the following New Servlet window. Give the Servlet name as “DemoServlet” and click on the “Next” button as shown in the below image.

how to use Create Servlet Application using NetBeans IDE

From the next window, configure the servlet deployment and click on the “Finish” button as shown in the below image.

how to use Create Servlet Application using NetBeans

Now open the DemoServlet and write down the Servlet Code here.

Creating Servlet using NetBeans

Creating HTML Page:

Now, create a HTML Page. Right click on the project, New -> HTML

Creating Java Servlet using NetBeans

Write the HTML code here.

Creating Java Servlet Application using NetBeans

Now change the welcome file as index.html.

Creating Servlet using NetBeans IDE

Now start the server and deploy your project. Click on run -> Run Project (WebAplication1)

Java Servlet Application using NetBeans

You can see that default page of your project is open, write your name -> login.

Creating Java Servlet Application using NetBeans

Final Output

Creating Java Servlet Application using NetBeans

In the next article, I am going to discuss Servlet Communication. Here, in this article, I try to explain how to use Create Servlet Application using NetBeans IDE. I hope you enjoy this Create Servlet Application using NetBeans IDE article.

Leave a Reply

Your email address will not be published. Required fields are marked *