Required String parameter 'id' is not present
问题详情:
简单的说,我就是通过ajax发起了一个post请求到后台,但是后台没有收到请求发过去的参数,并且还报了这样的错误。
错误描述告诉我们,请求参数里面并没有存在id。我检查的浏览器的请求,确实有带参数,拼写无误。
那么,必然就是接收方式出错了,参数错误或者是post请求不能这么接收。
前端页面,发起Ajax请求,请求方式为post。
$.ajax({
url: "test/test",
type:"POST"
data:'{"id":"1111","date":"2018"}',
success: function(){
.....
}});
后端代码,接收方式为@ PostMap("/test"),@RequestParam
@GetMapping("/test")
@RequiresPermissions({"test"})
@ResponseBody
public TableDataInfo test(@RequestParam String id,@RequestParam String date)
{
......
}
解决方案:
1、将后台代码的 @RequestParam 改为@RequestBody
测试后发现有问题,报错。
2、干脆不用post请求,改为get,亲测有效。
Required String parameter 'id' is not present的更多相关文章
- 后台接收参数报错 Required String parameter 'id' is not present
来自:https://blog.csdn.net/qq_15238647/article/details/81539287 关于ajax请求spring后台出现 Required String par ...
- required string parameter XXX is not present
@RequestParam jQuery调用方式: deleteFile: function(filePath) { return ajax({ method: 'POST', url: '/cm/s ...
- required string parameter 'XXX'is not present 的几种情况
required string parameter 'XXX'is not present 的几种情况 情况一:原因是由于头文件类型不对,可以在MediaType中选择合适的类型,例如GET和POST ...
- 报错:required string parameter XXX is not present
报错:required string parameter XXX is not present 不同工具发起的get/delete请求,大多数不支持@RequestParam,只支持@PathVari ...
- HTTP Status 400 - Required String parameter 'userName' is not present 错误
HTTP Status 400 - Required String parameter 'userName' is not present 错误 先mark 有时间详细写 参考链接: https:/ ...
- Jpa 报错 :HTTP Status 400 - Required String parameter 'xx' is not present
一.问题描述 使用Springboot JPA 做分页查询,报错Required String parameter 'xx' is not present,后端未接受到请求 二.解决方案: 使用的请求 ...
- 400错误,Required String parameter 'paramter' is not present
1.就拿简单的登录来说吧,这是开始的代码 @RequestMapping(value="/login")public ModelAndView login(@RequestPara ...
- org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxxx' is not present
org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'xxx ...
- Required String parameter 'images' is not present
后台控制层控制为非必填即可: @RequestMapping("/addDo") @SJson @SLog(description = "Car_main") ...
随机推荐
- CMDB Autoclient思路分析
1.start.py里的script.run():执行run函数--> 2.script.py run方法--> 3.判断模式MODE(Agent/SSHSALT)-->4.执行cl ...
- C# 给窗体添加皮肤 - SkinEngine的应用
C# 给窗体添加皮肤 - SkinEngine的应用 C#中利用 IrisSkin2.dll 所提供的控件 SkinEngine 来为窗体添加皮肤.这种方法最简单 具体步骤: .添加控件SkinE ...
- GPU编程自学3 —— CUDA程序初探
深度学习的兴起,使得多线程以及GPU编程逐渐成为算法工程师无法规避的问题.这里主要记录自己的GPU自学历程. 目录 <GPU编程自学1 -- 引言> <GPU编程自学2 -- CUD ...
- swift 函数参数——实参与形参
实参 在传入函数之前已有明确定义. 具体定义为 func funcName( actualParameter: Type ) {} 形参 参数只在此函数内有效并可使用,函数外不需要有明确定义. 具体定 ...
- JAVA多线程----用--死锁
(1) 互斥条件:一个资源每次只能被一个进程使用.(2) 请求与保持条件:一个进程因请求资源而阻塞时,对已获得的资源保持不放.(3) 不剥夺条件:进程已获得的资源,在末使用完之前,不能强行剥夺.(4) ...
- 【解题报告】13级个人结业赛(二) ——动(dou)态(bu)规(hui)划(zuo)专场
额.果然是动(dou)态(bu)规(hui)划(zuo)专场... A: 翻倍序列 dp[i][j]表示第i个位置是j的情况的个数那么dp[i][j]=∑dp[i-1][k] (j%k==0)初始 ...
- jquery动态增加或删除tr和td【实际项目】
难点: (1)动态增加.删除tr和td (2)每天tr和td都有下标,且下标要动态变化, (3)tr和td为什么下标不能随便写,原因是此处需要把所有tr中的数据以list的形式发送到后台对象中,所有每 ...
- div横排放置对齐问题;block,inline,inline-block区别
1.左右两个div都设置为float:left,如果右边div没有设置宽度,右边div的宽度会根据div里的内容自动调整. 缺点:不易控制 2.只有左侧div设置为float:left,右侧div设置 ...
- (function($){...})(jQuery)与$(function(){...})区别
$(function(){...}) 这种写法和jQuery(function(){...}),$(document).ready(function(){...})作用一样,表示文档载入后需要运行的代 ...
- bzoj 4303 数列
bzoj 4303 数列 二维 \(KD-Tree\) 模板题. \(KD-Tree\) 虽然在更新和查询的方式上类似于线段树,但其本身定义是类似于用 \(splay/fhq\ treap\) 维护区 ...