huanxuan163 2017-05-04 02:48 采纳率: 0%
浏览 7951
已采纳

springMVC中的reponseEntity是干什么用的?

看公司的项目 controller层里方法的返回值全都是ReponseEntity
这是干什么用的?

  @RequestMapping(value = "/getLeaderPosts", method = RequestMethod.POST)
    @ResponseBody
    public ResponseEntity<List<PostsDTO>> getLeaderPosts(@CurrentUserState UserState userState,@RequestBody PageInfo pageInfo, @RequestBody(required = false) PostsDTO dto) {
        ResponseEntity<List<PostsDTO>> retRes = new ResponseEntity<List<PostsDTO>>();
        PageBounds pageBounds = new PageBounds(pageInfo.getPage(), pageInfo.getPageSize());
        dto.setCreateUserId(userState.getUserId());
        retRes.setEntity(postsService.getLeaderPosts(dto, pageBounds));

        return retRes;
    }
  • 写回答

4条回答 默认 最新

  • 时间在这里停顿 2017-05-04 02:51
    关注

    响应实体类,自己定义的

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 已采纳回答 10月11日

悬赏问题

  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作