简体   繁体   English

无法读取Java Spark中的发布数据

[英]Unable to read post data in java spark

while posting data on server using request.body() gives me following string 使用request.body()在服务器上发布数据时,给了我以下字符串

------WebKitFormBoundaryq4DMNKuOxDn756Pn 
Content-Disposition: form-data; name="checksum" 
test 
------WebKitFormBoundaryq4DMNKuOxDn756Pn 
Content-Disposition: form-data; name="check_sum" 
testing
------WebKitFormBoundaryq4DMNKuOxDn756Pn--

but when I try to use request.attribute() to access post data it is giving me null value. 但是当我尝试使用request.attribute()访问帖子数据时,它给了我null值。

You should use like this for normal data :- 您应该像这样使用普通数据:-

 request.getParameter("checksum");
  request.getParameter("check_sum");

And if it is file or something use below :- 如果它是文件或下面使用的东西:

  Iterator<String> itr =  request.getFileNames(); 
  MultipartFile mpf = request.getFile(itr.next());   

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM