Skip to content
Related Articles

Related Articles

Creating First Servlet Application using NetBeans IDE

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 30 Jan, 2022

Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver. NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called modules. NetBeans runs on Windows, macOS, Linux, and Solaris.

Prerequisites: Install Netbeans 8.2, plugin Java EE Version, GlassFish 5.0 Server.

 Steps to Create Servlet  Application using NetBeans IDE

  1. Choose File > New > Java Web > Web Application
  2. Specify Project Name, Location, and Folder
  3. Choose Deployment Server
  4. Set Java EE version
  5. Specify Context Path
  6. Optionally choose Java framework
  7. Under Source packages node, add new Servlet class
  8. Add functionality to doPost() or doGet() method
  9. From index.html call the servlet
  10. Clean and Build project
  11. Run the project, index.html will be rendered on localhost.

Step 1: Choose File > New > Java Web > Web Application. Specify Project Name, Location, and Folder

Step 2: Choose Deployment Server. Set Java EE version. Specify Context Path

Under Source packages node, add new Servlet class

Step 3: Configure Servlet Deployment

Step 4: Servlet page

Step 5: Index HTML page

Step 6: Clean and build then run.

Step 7: Observe the output in the red box.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!