Yuvraj your sample code has
only a doGet() method. Now if a HTTP request uses GET, your code will work fine. But if a POST is used, it will fail, since your servlet does not support it.
Refer to arulk's code for a sample implementation of both doGet() and doPost().
Along with the servlet, if you have the security constraints in your DD,then the DD must also support both these methods.
Hope this helps
