Retrieve POST parameters only (Java)

前端 未结 6 2043
深忆病人
深忆病人 2021-01-04 10:03

Does anyone know of a way to get only POST parameters from an HttpServletRequest object?

IE, PHP has the $_POST superglobal and Perl\'s CGI.pm will only retrieve POS

6条回答
  •  温柔的废话
    2021-01-04 10:31

    The question was answered in this related post:

    Normaly you can GET and POST parameters in a servlet the same way:

    request.getParameter("cmd");
    

    But only if the POST data is encoded as key-value pairs of content type: "application/x-www-form-urlencoded" like when you use a standard HTML form.

提交回复
热议问题