我弄了个查询 结果什么值都没用传 却出了空指针 好郁闷的-----------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;
}
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;
}
解决方案 »
- STRUTS2 上传文件类型 限制问题!!!!!!!!!!
- hibernate加了驱动怎么还报错?
- 高分!FileOutputStream类write成UTF-8编码时出现乱码
- jxl读取Excel奇怪报错
- 请问 动态绑定事件 区分事件源问题
- ibatis如何配置C3P0数据库连接池呢
- 问一个关于servlet的基础问题?
- java实现支付宝接口
- 怎么用JAVA发传真?
- 请帮我看一下这段代码为什么连不上数据库。。。(I'm 菜鸟)
- 如何提取集合中重复的那几条数据
- There is no Action mapped for namespace / and action name yyxkbAction.
一new,对象就是空的