ajax 参数出现在Request payload导致request.getParameter(name)是获取不到值

Posted 钟政123

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ajax 参数出现在Request payload导致request.getParameter(name)是获取不到值相关的知识,希望对你有一定的参考价值。

 

参考:http://stackoverflow.com/questions/10494574/what-is-the-difference-between-form-data-and-request-payload

if a request (typically POST) has Content-type header set to application/x-www-form-urlencoded the body is expected to be in the form of a standard querystring with url-encoded key=value pairs joined by &. Form data section then shows the key-value parameters (when viewed parsed). This way was much more common in past because it is a default for html forms.

other cases are shown in Request payload section (and nowadays parsed for readability as well for common formats like JSON).

如果请求的Content-Type设置为application/x-www-form-urlencoded,那么这个Post请求被认为是HTTP POST表单请求,参数出现在

其他情况如使用原生AJAX的POST请求如果不指定请求头Request Header,默认使用的Content-Type是text/plain;charset=UTF-8,参数出现在Request payload块。

以上是关于ajax 参数出现在Request payload导致request.getParameter(name)是获取不到值的主要内容,如果未能解决你的问题,请参考以下文章

AJAX POST请求中参数以form data和request payload形式在servlet中的获取方式

AJAX POST请求中参数以form data和request payload形式在servlet中的获取方式

ajax Form提交与Payload提交

jquery控制Request Payload和Form Data

POST请求中参数以form data和request payload形式+清空数组方式

payload form data 参数和附件