这个错误是怎么回事,大神帮看一看 There was an unexpected error (type=Bad Request, status=400).

心大自然宽 2020-11-12 11:12:33
There was an unexpected error (type=Bad Request, status=400).
Required Integer parameter 'id' is not present


这个错误是怎么回事,大神帮看一看
Controller
/**
* 根据ID查询全文
* */

@RequestMapping("/findById")
public testpojo findByBId(@RequestParam("id")Integer id){
testpojo time1 = apiService.selectArticleWithId(id);
return time1;
}
Service
//根据ID查询文章

public testpojo selectArticleWithId(int id) {
testpojo time1 = apiMapper.selectArticleWithId(id);
return time1;
}
Mapper
// 根据id查询文章信息
public testpojo selectArticleWithId(int id);


<!-- 根据ID查询所有-->
<select id="selectArticleWithId" resultType="String">
SELECT * FROM time WHERE id =#{id}
</select>
...全文
3192 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
luj_1768 2020-11-13
  • 打赏
  • 举报
回复
服务超时,没有能够按时间返回。
咦哟~~~ 2020-11-12
  • 打赏
  • 举报
回复 1
方法中定义了@RequestParam变量,如果访问的URL中不带有相应的参数,就会抛出异常,你应该没有传id这个参数,还有既然你controller中要返回查询到的数据,为啥你不加上@ResponseBody注解呢,要是不适用@ResponseBody 默认这个方法是要走视图处理器,跳转页面的

51,411

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧