findaction.java
来自「权限管理系统(Hibernate技术).rar 权限管理系统 有增加」· Java 代码 · 共 69 行
JAVA
69 行
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.yourcompany.struts.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.dao.Udao;
import com.pojo.User;
/**
* MyEclipse Struts
* Creation date: 11-15-2008
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class FindAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
int intPageSize;//一页显示的记录数
int intRowCount; //记录总数
int intPageCount;//总页数
int intPage; //待显示页码
java.lang.String strPage;
intPageSize=4;
strPage = request.getParameter("page");
if(strPage==null){//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
}else{//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
if(intPage<1) intPage = 1;
}
Udao dao=new Udao();
List l=dao.getAll();
//System.out.println(list);
List list=dao.findPagedAll(intPage, intPageSize);
intRowCount=l.size();
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
if(intPage>intPageCount) intPage = intPageCount;
request.getSession().setAttribute("intPageSize",intPageSize);
request.getSession().setAttribute("intRowCount",intRowCount);
request.getSession().setAttribute("intPageCount",intPageCount);
request.getSession().setAttribute("intPage",intPage);
request.getSession().setAttribute("list", list);
return mapping.findForward("goto");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?