<form method="post" action="">
    <input type=text name="nm" />
</form>
request.getParameter("nm");
I can get the parameter named nm, but I can't confirm it's confirm method ,post or get??
<form method="post" action="">
    <input type=text name="nm" />
</form>
request.getParameter("nm");
I can get the parameter named nm, but I can't confirm it's confirm method ,post or get??
 
    
    request.getMethod() returns the web method used (post, get etc...)
 
    
    From JavaEE 6 docs HttpServletRequest#getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.
 
    
    By default if you dont specify anything in your form ,
<form action="">
   <input type=text name="nm" />
</form>
it will be get . (i.e) you need to override doGet . ti know the method used , you can achieve it through request.getMethod() which returns a String specifying the name of the method with which this request was made . see this to understand the difference What is the difference between POST and GET? and use the appropriate one.
Hope this helps !!