genon123 2021-08-30 17:21 采纳率: 100%
浏览 138
已结题

SpringBoot项目分页获取数据 java.lang.NullPointerException: null

背景:没学过前端,现在需求写个网页项目,然后突击学习了一下。测试连接数据库已经可以连接,test时数据断点也看到都是正确的,但是在尝试将数据返回前台时发生了如下错误,麻烦各位有经验的指点一下,具体错误如下:

Controller如下图:
img

运行报错:

img

后台报错截图:

img

img
2021-08-30 17:13:00.064 ERROR 11784 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

2021-08-30 17:13:00.329 ERROR 11784 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [favicon.ico], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [favicon.ico], template might not exist or might not be accessible by any of the configured Template Resolvers

Impl源码:

img

前端html代码:

img

尝试将 “ return userListService.findData(page, limit);”的 page手动赋值1000,limit赋值20:

img

重新运行后发现不报错,但是JSON数据为空:
img

vo写了个toString:

img

后台发现赋值没成功,全部为空:
img

  • 写回答

4条回答 默认 最新

  • XiaohuFight 2021-08-30 17:50
    关注

    1、对于 page,limit 手动赋值可以执行,是不是前端数据没有传到后台,输出到控制台看有没有
    2、对于数据为空,看分页查询有没有拿到数据,xml里查询语句写得是否正确或者querywrapper条件是否正确

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

报告相同问题?

问题事件

  • 系统已结题 9月7日
  • 已采纳回答 8月30日
  • 创建了问题 8月30日

悬赏问题

  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
  • ¥15 下列c语言代码为何输出了多余的空格