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") ...
随机推荐
- (转载) Chrome中canvas上drawImage无法画出image的解决办法
在自己写demo的过程中 碰到了这样一个问题 发现drawImage方法没有达到预期的效果 图片没办法显示 而fillRect等画图形的方法却工作良好 大概的代码如下: $(function() { ...
- 添加operations模块
添加operations模块,models内容为: from django.db import models from datetime import datetime from users.mode ...
- Gradle 1.12用户指南翻译——第六十四章. 发布到Ivy(新)
其他章节的翻译请参见:http://blog.csdn.net/column/details/gradle-translation.html翻译项目请关注Github上的地址:https://gith ...
- EasyRTMP+EasyRTSPClient实现的多路(支持断线重连)RTSP转RTMP直播推流工具
本文转自EasyDarwin开源团队成员Kim的博客:http://blog.csdn.net/jinlong0603/article/details/73441405 介绍 EasyRTMP是Eas ...
- vscode+Firefox实现前端移动真机测试
需要配件: 1.安装有火狐浏览器的移动端(手机); 2.安装有火狐浏览器和vscode的pc(电脑); 3.在vscode安装Live Server 插件 4.安装之后vscode右下角会有Go Li ...
- PHP 关于empty和isset对于参数的判断结果
<?php class test{} $a1 = null; $a2 = ""; //$a3 = $a4 = 0; $a5 = '0'; $a6 = false; $a7 = ...
- (android 地图实战开发)2 创建MapActivity,根据设备当前位置,显示地图
(android 地图实战开发)2 创建MapActivity,根据设备当前位置,显示地图 http://www.cnblogs.com/macroxu-1982/archive/2011/09/13 ...
- vim简单的文本编辑命令
<blockquote>:e! enter</blockquote>消除所有这次编辑的,回到原来文件的样子.不过此文件还是打开状态.<blockquote>:q! ...
- erl_0016 《硝烟中的erlang》 读书笔记003 “error_logger 爆炸”
error_logger 爆炸 具有讽刺意味的是,负责错误日志的进程竟然是最为脆弱的之一.在Erlang的缺省安装中,error_logger39负责记录日志(写入磁盘或者发送到网络上),它的速度要比 ...
- selenium-java,cookie登陆
方法 public void login(WebDriver WebDriver,String cookie1[],String cookie2[]) throws ParseException{// ...