java.lang.NullPointerException
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)
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;
}
...全文
相关推荐
java.lang.NullPointerException出现的几种原因及解决方案
java.lang.NullPointerException出现的几种原因及解决方案java.lang.NullPointerException是Java中最常见的异常之一,它经常出现在日常编程中。
java.lang.NullPointerException的解决方法
### Java.lang.NullPointerException 解决方法详解在Java开发过程中,`java.lang.NullPointerException`(简称NPE)是一种常见的运行时异常
CRASH问题:java.lang.NullPointerException
在Android开发中,遇到"CRASH问题:java.lang.NullPointerException"(空指针异常)是一个常见的问题,特别是在处理用户界面元素时。这个错误通常发生在试图调用一个n
绝望,上传文件失败。。遇到并解决java.lang.NullPointerException
遇到并解决java.lang.NullPointerException - 将文件编码方式改为utf-8解决NullPointerException”在编程过程中,我们经常
java.lang.NullPointerException的可能原因及处理.docx
Java.lang.NullPointerException 的可能原因及处理Java.lang.NullPointerException 是 Java 语言中最常见的异常之一,它的出现通常是由于编程不当或对象未被正确初始化所致


Eclipse
