Today, I spent a few minutes following a course from Lynda – Java EE Essentials: Servlets and Java Server Faces. It was amazing how easy it is to set up the environment and get a application up and running on your desktop. Also later on can easily be exported into a production environment.
Here are four screenshots that I have taken while following the tutorial. The structure might looks a bit intimidating but those are all auto generated. And the only parts you need to modify is the html file under WebContent and the Servlet.java under Java Resources. Also, 90% of the code in Servlet.java are auto generated too.
In a nutshell, a few clicks plus a few lines of customized Java code, you just build an API using Java servlet!

The inputForm.html where end user enter input argument

Source code for inputForm.html

Source code for the Servlet.java

How the final output looks like