java.lang.NullPointerException

armi100 armi100 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Struts Problem Report
Struts has detected an unhandled exception:

Messages:
File: com/sterning/books/web/actions/BooksAction.java
Line number: 40


--------------------------------------------------------------------------------

Stacktraces
java.lang.NullPointerException
com.sterning.books.web.actions.BooksAction.list(BooksAction.java:40)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)




package com.sterning.books.web.actions;

import java.util.Collection;

import com.sterning.books.model.Books;
import com.sterning.books.services.iface.IBooksService;
import com.sterning.commons.AbstractAction;
import com.sterning.commons.Pager;
import com.sterning.commons.PagerService;

public class BooksAction extends AbstractAction {

private IBooksService booksService;
private PagerService pagerService;

private Books book;
private Pager pager;

protected Collection availableItems;
protected String currentPage;
protected String pagerMethod;
protected String totalRows;
protected String bookId;
protected String queryName="1";
protected String queryValue="1";
protected String searchName;
protected String searchValue;
protected String queryMap;

public String list() throws Exception {
if(queryMap ==null||queryMap.equals("")){

}else{
String[] str=queryMap.split("~");
this.setQueryName(str[0]);
this.setQueryValue(str[1]);
}

//System.out.println("asd1"+this.getQueryValue());
//这里出错,网上的例子来的。。。。。: http://blog.csdn.net/zhicc/archive/2009/07/28/4386849.aspx
int totalRow=booksService.getRows(this.getQueryName(),this.getQueryValue());
pager=pagerService.getPager(this.getCurrentPage(), this.getPagerMethod(), totalRow);

this.setCurrentPage(String.valueOf(pager.getCurrentPage()));
this.setTotalRows(String.valueOf(totalRow));
availableItems=booksService.getBooks(this.getQueryName(),this.getQueryValue(),pager.getPageSize(), pager.getStartRow());

this.setQueryName(this.getQueryName());
this.setQueryValue(this.getQueryValue());

this.setSearchName(this.getQueryName());
this.setSearchValue(this.getQueryValue());

return SUCCESS;
}
...全文

相关推荐

评论 15
收藏 已收藏
分享
返回顶部
armi100
Eclipse 58,439 成员 49,457 内容