when you use Post method while submitting a form say
<form action="something(say your servlet)" method="post">
<input type="text" name="username"/>
</form>
Now at the time it goes to servlet you do request.getparameter("username")--->right but in browser url you will not see something like
http://localhost:8080/<ur servlet>?usernaame=xyz
becoz the above url is produced when get method is used
the way you are sending it explicitly by using javascript is like in a get manner but yet you can use getParameter