简体   繁体   English

所需的字符串参数“graphName”不存在

[英]Required String parameter 'graphName' is not present

var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
        console.log("excel download");
      }
    };
    xhttp.open("POST", "exportGraphExcel", true);
    xhttp.setRequestHeader("Content-type", "application/msexcel");
    xhttp.send('graphName=graphakki');

It gives 400 status in browser.它在浏览器中给出 400 状态。 If Content-type is changed to "application/x-www-form-urlencoded" then request is accepted.如果 Content-type 更改为“application/x-www-form-urlencoded”,则接受请求。

The content type in a request header is the content of what you're sending .请求标头中的内容类型是您发送的内容。 You're not sending an Excel file, you're requesting an excel file.您发送的不是 Excel 文件,而是请求 Excel 文件。

When you send the "application/x-www-form-urlencoded" content type header, you're telling the server that your parameters must be read in the URL ( this is the standard way ).当您发送"application/x-www-form-urlencoded"内容类型标头时,您是在告诉服务器您的参数必须在 URL 中读取( 这是标准方式)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 必需的字符串参数“ text”不存在 - Required String parameter 'text' is not present 所需的字符串参数不存在:与 fetch 通信 - Required String parameter is not present : communicate with fetch Spring Boot REST - 所需的字符串参数不存在 - Spring Boot REST - Required String parameter is not present 从 ajax 向 spring controller 发送数据:所需的字符串参数不存在 - sending data from ajax to spring controller: Required String parameter is not present 如何从 java 脚本 function 中调用 spring 服务 (RequestParam)(错误 400:必需的字符串参数“标志”不存在) - How to call spring service (RequestParam ) from in java script function (Error 400: Required String parameter 'flag' is not present) 发布错误必需的MultipartFile []参数不存在 - post error Required MultipartFile [ ] parameter not present Android Post to API无效,Ajax Post正常。 必需的字符串参数“名字”不存在” - Android Post to API Doesn't Work, Ajax Post Works OK. Required String parameter 'firstname' is not present" POST请求-字符串参数不存在 - POST request - String parameter is not present 处理程序执行导致异常:所需的MultipartFile参数'file'不存在 - Handler execution resulted in exception: Required MultipartFile parameter 'file' is not present org.springframework.web.bind.MissingServletRequestParameterException:必需长参数'userId'不存在“ - org.springframework.web.bind.MissingServletRequestParameterException : Required Long parameter 'userId' is not present"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM