错误信息:Required request parameter 'XXX' for method parameter type String is not present

这种都是前端请求方式不同,后端处理方式不同

  • 可以设置一下dataType
  • 一定要注意 @ResponseBody 的使用

最终在一个博主评论下面看见了解决答案:

还有一个致命的一点,@ResponseBody本身不强制内容,返回的就是文本。如果方法体返回的是对象,大概率会调用这个对象的toString(),可以是重写也可以继承的,如果是JSON对象也是这样。具体这个我没测试,因为我用@ResponseBody的所有controller方法都强制是自己可控的String,如果你的controller方法参数是Integer,并且加了注解@ResponseBody,绝大多数报错。需要改成String 型的。

错误:Required request parameter 'XXX' for method parameter type String is not present的更多相关文章

  1. android switch(String)错误:Cannot switch on a value of type String for source level below 1.7

    switch语句的判断条件可以接受int,byte,char,short,不能接受其他类型只有JDK版本1.7以上才可以支持String 设置如下可解决问题:(若没有JDK1.7版,可下载一下安装)菜 ...

  2. @RequestBody对象为空,异常Required request body is missing错误解决

    1.异常 org.springframework.http.converter.HttpMessageNotReadableException: Required request body is mi ...

  3. DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing

    客户端当发送空的json字符串时,请求RestController时,报错: DefaultHandlerExceptionResolver : Failed to read HTTP message ...

  4. required string parameter XXX is not present

    @RequestParam jQuery调用方式: deleteFile: function(filePath) { return ajax({ method: 'POST', url: '/cm/s ...

  5. required string parameter 'XXX'is not present 的几种情况

    required string parameter 'XXX'is not present 的几种情况 情况一:原因是由于头文件类型不对,可以在MediaType中选择合适的类型,例如GET和POST ...

  6. Parameter 0 of method redisTemplate in org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactor

    Error starting ApplicationContext. To display the conditions report re-run your application with 'de ...

  7. Parameter 0 of method sqlSessionTemplate in org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration required a single bean, but 2 were found:

    Parameter 0 of method orderSqlSessionFactory in com.config.MultipleDBConfig required a single bean, ...

  8. 报错:required string parameter XXX is not present

    报错:required string parameter XXX is not present 不同工具发起的get/delete请求,大多数不支持@RequestParam,只支持@PathVari ...

  9. Better exception message for missing @RequestBody method parameter

    https://jira.spring.io/browse/SPR-12888 Description When I use @RequestBody on one of my controllers ...

  10. 请求(Request)的参数(Parameter)里包含特殊字符(#等)的正确处理方式

    遇到一个问题 在一个地址链接(URL)里使用 url?param1=val1&param2=val2 的方式传递参数,结果在获取参数值时发现不是当初设定的值. 具体案例 以特殊字符井号(#)为 ...

随机推荐

  1. 4.Gitlab CI 与 Kubernetes 的结合

    参考网址:https://www.qikqiak.com/post/gitlab-ci-k8s-cluster-feature/

  2. jq判断页面滚动条进行样式修改

    $(window).scroll(function(){//窗口的滚动条 if($(window).scrollTop()>100){ //垂直滚动条钓offset 大于90时. $(" ...

  3. 洛谷P2367 语文成绩(差分)

    标准的差分应用题,不要想的太复杂,写成了线段树. 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=5e6+10 ...

  4. 集合元素的遍历操作,使用迭代器Iterator接口

    1.内部的方法:hasNext() 和 next() 推荐的方式: //hasNext():判断是否还有下一个元素while(iterator.hasNext()){ //next():①指针下移 ② ...

  5. DevOps|1024程序员节怎么做?介绍下我的思路

    1024,祝每个程序员小哥哥小姐姐节日快乐. 因为在研发效能部门,我支持过几次 1024 程序员节的活动,所以经常有朋友问我1024 程序员节怎么做,本篇就是简单介绍下我的思路,希望对你有用. 102 ...

  6. Elasticsearch rest-high-level-client 基本操作

    Elasticsearch rest-high-level-client 基本操作 本篇主要讲解一下 rest-high-level-client 去操作 Elasticsearch , 虽然这个客户 ...

  7. RDD(弹性分布式数据集)及常用算子

    RDD(弹性分布式数据集)及常用算子 RDD(Resilient Distributed Dataset)叫做弹性分布式数据集,是 Spark 中最基本的数据 处理模型.代码中是一个抽象类,它代表一个 ...

  8. python字符串的一些操作

    # 1.变量的多次赋值 print('1.变量的多次赋值') name = '小明' # 没有意义的 name = '小刚' # 对前面创建的变量名称进行覆盖 # 删除原来的数据,写入新的数据 pri ...

  9. Python基础之函数:5、内置函数、迭代器对象、异常的捕获和处理

    目录 一.重要内置函数 1.zip() 2.filter() 3.sorted() 二.常见内置函数 1. abs() 2.all.any() 3.bin.oct.hex.int() 4.bytes( ...

  10. Linux 挂载Windows共享文件夹和NAS存储

    summary: [Linux 挂载共享存储] 概述 将Windows共享文件夹和NAS存储挂载至Linux. Linux系统环境:CentOS 挂载共享存储 查看外部主机共享了哪些目录 smbcli ...