jsp servlet哪里错了?
jsp前台 all=0没有数据啊
<form action="AdminServlet?flag=List" method="post" name="name">
<%
PageHelp ph = (PageHelp)request.getAttribute("all");
List all = ph.getPageList();
%>
Servlet接收
if ("List".equals(flag)) {
String ID = request.getParameter("ID");
int id = 0;
if (ID != null && !"".equals(ID)) {
id = Integer.parseInt(ID);
}
String userName = request.getParameter("username");
String role = request.getParameter("role");
String quanxian = request.getParameter("quanxian");
List all = new ArrayList();
PageHelp ph = new PageHelp();
ph.setPageSize(10);
int page = 1;
int startRow = 0;
String pageNo = request.getParameter("page");
if (pageNo != null) {
page = Integer.parseInt(pageNo);
}
ph.setCurPage(page);
startRow = (page - 1) * (ph.getPageSize());
ph.setTotulRows(DaoFactory.getAdminDaoInstance().getTotulRows(
userName, role, quanxian));
ph.init(ph.getTotulRows());
all = DaoFactory.getAdminDaoInstance().getAll(startRow,
ph.getPageSize(), id, userName, role, quanxian);
ph.setPageList(all);
request.setAttribute("all", ph);
path = "./admin/adminList.jsp";
}
}
request.getRequestDispatcher(path).forward(request, response);
------解决方案--------------------代码,页面贴完整。
------解决方案--------------------Connection conn = null;
连接对象位null
本应该是 conn=db.getConn();吗
空指针 ------解决方案--------------------空指针异常。如果你的Servlet没有错的话,那就是你dao包内的问题。。你在那调试下
------解决方案--------------------哦。。。我没看清。你找到了。