浏览器访问http://127.0.0.1:9000/business/admin/chapter/list?page=1&size=1出现http状态码400
来源:5-4 分页功能开发
			慕圣4596589
2022-07-18
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Jul 19 10:29:44 CST 2022
There was an unexpected error (type=Bad Request, status=400).
Required request body is missing: public com.course.server.dto.PageDto com.course.business.controller.admin.ChapterController.list(com.course.server.dto.PageDto)
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.course.server.dto.PageDto com.course.business.controller.admin.ChapterController.list(com.course.server.dto.PageDto)
vue:
<script>
export default {
  name: "chapter",
  data:function () {
    return {
      chapters:[]
    }
  },
  mounted: function() {
    let _this = this;
    _this.list();
    //sidebar 激活样式 方式一
    // this.$parent.activeSidebar("business-chapter-sidebar");
  },
  methods: {
    list() {
      let _this = this;
      _this.$ajax.post('http://127.0.0.1:9000/business/admin/chapter/list', {
        page: 1,
        size: 1
      }).then((response)=>{
        console.log("查询大章列表结果:", response);
        _this.chapters = response.data.list;
      })
    }
  }
}
</script>
ChapterController
@RestController
@RequestMapping("/admin/chapter")
public class ChapterController {
    private static final Logger LOG = LoggerFactory.getLogger(ChapterController.class);
    @Resource
    private ChapterService chapterService;
    @RequestMapping("/list")
    public PageDto list(@RequestBody PageDto pageDto) {
        LOG.info("pageDto: {}", pageDto);
        chapterService.getList(pageDto);
        return pageDto;
    }
}
2回答
- 
				
				
不能直接在浏览器访问:http://127.0.0.1:9000/business/admin/chapter/list?page=1&size=1,这种方式的参数是拼在url里的,不是放在request body里,所以后端接收不到参数,就会报错:Required request body is missing:
112022-07-19 - 
				
						super_小小胡
2022-07-19
9000端口是网关吧,你确定热部署重启成功了嘛012022-07-19 
相似问题