Prodigy/kf智
我的博客
posts - 20,comments - 7,trackbacks - 0
ShowlistAction 处理请求然后根据 具体进行分页 //Created by MyEclipse Struts // XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.1/xslt/JavaClass.xsl package com.xiaozhi.pagebean; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.xiaozhi.user.User; /** * MyEclipse Struts * Creation date: 04-06-2006 * * XDoclet definition: * @struts.action input="/errors/errors.jsp" validate="true" */ public class ShowlistAction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) { User us = new User() ; List list = us.select_find() ; request.setAttribute("list",list) ; String pn = request.getParameter("pn"); if(pn == null) { pn = "0" ; } int page = Integer.parseInt(pn) ; System.out.println("#############"+page+"###########") ; //创建分页实例 PageBean pb = new PageBean() ; //设置每页显示的数目 pb.setEverypage(3) ; //先设置最多有多少个数据 根据他得到一共有多少页 pb.setCountdata(list.size()) ; //设置当前页面 pb.setCurrentPage(page) ; request.setAttribute("pbs",pb) ; return mapping.findForward("show"); } }
posted on 2006-04-17 11:22 xiaozhi 阅读(246) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: