Reading and practice what this tutorial is about: http://www.journaldev.com/1877/java-servlet-tutorial-with-examples-for-beginners