Right click the mouse on created web project and select New -> Servlet from the menu.
ServletProgrammatically
\ServletProgrammatically\src
web.app
ProgServlet
ProgServlet
Select a class name, ProgServlet, and a package name, web.app, for the Servlet. After this press the Next Button.
ProgServlet
/ProgServlet
In this window, it is intended to set up deployment descriptor data for the Servlet.
Let the name and URL mapping be as proposed and press Finish button
You are now ready to change the servlet class to your needs.