我弄了个查询 结果什么值都没用传 却出了空指针  好郁闷的-----------action --------------
public String findAll() { String pageIndex = ServletActionContext.getRequest().getParameter(
"pageIndex");
int p1 = 1;
if (pageIndex != null && !"".equals(pageIndex)) {
p1 = Integer.parseInt(pageIndex);
} else {
p1 = 1;
}
Yyxkb dp = new Yyxkb(); int totalNumOfRows = xkservice.count(dp); PaginationTable pt = new PaginationTable(totalNumOfRows, p1);
int beginIndex = pt.getBeginIndex(); list = xkservice.findAll(dp, beginIndex, beginIndex+10);
getRequest().setAttribute("list", list);

getRequest().setAttribute("pt", pt);
return "list"; }
--------------------service--------------
public int count(Yyxkb yy) {
int count=0;
 count = this.getHibernateTemplate().findByExample(yy).size();
 return count;
}

解决方案 »

  1.   

    把异常贴上来,看看哪一行出现nullpointer
      

  2.   

    int totalNumOfRows = xkservice.count(dp);就是这句了
      

  3.   

    如果this.getHibernateTemplate().findByExample(yy)返回NUll就没有size了
      

  4.   

    你Yyxkb是什么,类?
    一new,对象就是空的
      

  5.   

    我刚发现了  我的名字错了 两个配置文件里的和 还有action里的不一样  所以错了谢谢大家啦