这个异常该怎么解决

liyankaipoi 2017-07-17 02:09:35
serachAppTypeList(PageRequestBean<AppboxAppType> requestBean,Model model){
Integer count = appboxAppTypeService.findCount();
Pagination pagination = new Pagination(count,requestBean.getPageSize(), requestBean.getPage());
Integer totalPage = pagination.getTotalPage();
ArrayList<RespAPPTypeVo> respAPPTypeVo = appboxAppTypeService.findListToPage(pagination);



Pagination pagination = new Pagination(count,requestBean.getPageSize(), requestBean.getPage());报空指针异常变成这样就好了怎么解决Pagination pagination = new Pagination(count)
...全文
241 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
liyankaipoi 2017-07-17
  • 打赏
  • 举报
回复
引用 7 楼 shansongjia 的回复:
1:如果是requestBean为null,那么就照着之前那位给的判断就行了 2:如果是getPageSize和getPage为空,那么可以对requestBean里的这两个方法进行修改 public Integer getPage() { return page == null ? 1 : page; } public Integer getPageSize() { return pageSize == null ? 10 : pageSize;}
多谢,但是我还有应该问题, <div class="row"> <div class="pager"> <ul class="pagination" id="paginationQuery"> <li><c:choose> <c:when test="${logvos.pagination.first }"> <a data-page='1'>«</a> </c:when> <c:otherwise> <a href="#" data-page='${logvos.pagination.prevPage }'>«上一页</a> </c:otherwise> </c:choose></li> <c:if test="${logvos.pagination.totalPage > 5 }"> <c:forEach begin="${logvos.pagination.page - 2 }" end="${logvos.pagination.page + 2 > logvos.pagination.totalPage ? logvos.pagination.totalPage : (logvos.pagination.page + 4) }" varStatus="status"> <c:choose> <c:when test="${logvos.pagination.page eq status.index }"> <li><a href="#" data-page='${status.index }' style="color: red;">${status.index }</a></li> </c:when> <c:otherwise> <li><a href="#" data-page='${status.index }'>${status.index }</a></li> </c:otherwise> </c:choose> </c:forEach> </c:if> <c:if test="${logvos.pagination.totalPage <= 5 }"> <c:forEach begin="1" end="${logvos.pagination.totalPage }" step="1" varStatus="status"> <c:choose> <c:when test="${logvos.pagination.page eq status.index }"> <li><a href="#" data-page='${status.index }' style="color: red;">${status.index }</a></li> </c:when> <c:otherwise> <li><a href="#" data-page='${status.index }'>${status.index }</a></li> </c:otherwise> </c:choose> </c:forEach> </c:if> <li><c:choose> <c:when test="${logvos.pagination.last }"> <a data-page='${logvos.pagination.page }'>»</a> </c:when> <c:otherwise> <a href="#" data-page='${logvos.pagination.nextPage }'>下一页»</a> </c:otherwise> </c:choose></li> 这里边的logvos不就应该是controller里map里的参数吗?
  • 打赏
  • 举报
回复
风吹过夏天 2017-07-17
  • 打赏
  • 举报
回复
Buguanjia-Ssj 2017-07-17
  • 打赏
  • 举报
回复
1:如果是requestBean为null,那么就照着之前那位给的判断就行了
2:如果是getPageSize和getPage为空,那么可以对requestBean里的这两个方法进行修改
public Integer getPage() {
return page == null ? 1 : page;
}
public Integer getPageSize() {
return pageSize == null ? 10 : pageSize;}
liyankaipoi 2017-07-17
  • 打赏
  • 举报
回复
测试出来了getPage为null,但是怎么会出现这个问题呢,该怎么解决啊
liyankaipoi 2017-07-17
  • 打赏
  • 举报
回复
还有就是在我提交数据的时候,数据提交到数据库中了,但是前台页面查不出来是什么情况。
ghx287524027 2017-07-17
  • 打赏
  • 举报
回复
requestBean.getPageSize(), requestBean.getPage()这俩参数有问题,测试一下
liyankaipoi 2017-07-17
  • 打赏
  • 举报
回复
但是我进行判断requestbean还不是null
自由自在_Yu 2017-07-17
  • 打赏
  • 举报
回复
if(requestBean != null ){
    Pagination pagination = new Pagination(count,requestBean.getPageSize(), requestBean.getPage());
}else{
    Pagination pagination = new Pagination(count);
}
qq_35942223 2017-07-17
  • 打赏
  • 举报
回复
requestBean为null?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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