inside the servlet:
This works perfectly but I fail to understand why so because passing parementer in URL is GET style how does POST method of servlet handle this?
It's still a request parameter. The difference is that with a GET, *all* parameters are sent as part of the URL (there is no request body), whereas with POST parameters are sent in the request body. Unless you take pains to send parameters as part of the URL as well, like you did. If you initiate a proper form submission and look at the HTTP in transmission (using a tool like the LiveHTTPHeader plugin for Firefox) you'll see the difference.
when you use Post method while submitting a form say
<form action="something(say your servlet)" method="post">
<input type="text" name="username"/>
Now at the time it goes to servlet you do request.getparameter("username")--->right but in browser url you will not see something like
becoz the above url is produced when get method is used