[b]对于带条件查询的分页,用到的主要是session,在提交时判断是不是第一次提交,如果是session.getAttribute("condition") ==null 则为空,同时创建一个新的这里我们用Map 存放健值对,并将此对象的放入session。 前面我们可以这样写 <fieldset> <legend>物料搜索</legend> <form action="GoodsAction?type=selectSome" method="post"> 物料名字:<input type="text" name='goodsName' value="${condition['goodsName']} " /> 物料类型<input type="text" name="goodsType" value="${condition['goodsType'] }"/><br/> <input type="submit"/> <hr/> </form> </fieldset> <table border=1> <tr> <th>名字</th> <th>数量</th> <th>价格</th> <th>类型</th> <th>供应商</th> </tr> <c:forEach var ="temp" items="${page.list}"> <tr> <td>${temp.name }</td> <td>${temp.count }</td> <td>${temp.price }</td> <td>${temp.type_id }</td> <td>${temp.provider_id}</td> </tr> </c:forEach> </table> <jsp:include page="../page.jsp"> <jsp:param value="GoodsAction" name="name"/> <jsp:param value="selectSome" name="type"/> </jsp:include> --------------------------- 后台 String pageNum = request.getParameter("pageNum"); String goodsName = request.getParameter("goodsName"); String goodsType = request.getParameter("goodsType"); HttpSession session = request.getSession(); Map<String, String> condition = (Map<String, String>) session.getAttribute("condition"); if (condition == null) { condition = new HashMap<String, String>(); session.setAttribute("condition", condition); } if (goodsName != null) { condition.put("goodsName", goodsName); } if (goodsType != null) { condition.put("goodsType", goodsType); } if (pageNum == null) pageNum = "1"; PageInfo p = new PageInfo(Integer.parseInt(pageNum), 10, "t_s_goods"); dao.getAll(p, condition); request.setAttribute("page", p); request.getRequestDispatcher("goods/goods_list.jsp").forward(request,response);[/b]