⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showallclientinfoaction.java

📁 上一上传oa系统漏掉web-inf文件夹
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.oa.manage.action;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

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.oa.crm.db.ClientInfo;
import com.oa.crm.db.ClientInfoDAOImpl;
import com.oa.crm.form.ClientInfoForm;
import com.oa.page.PageBean;

/** 
 * MyEclipse Struts
 * Creation date: 09-23-2007
 * 
 * XDoclet definition:
 * @struts.action path="/showAllClientInfo" name="clientInfoForm" scope="request" validate="true"
 */
public class ShowAllClientInfoAction extends Action {
	private ClientInfoDAOImpl clientInfoDao;

	private PageBean pageBean;

	public void setPageBean(PageBean pageBean) {
		this.pageBean = pageBean;
	}

	public void setClientInfoDao(ClientInfoDAOImpl clientInfoDao) {
		this.clientInfoDao = clientInfoDao;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		response.setCharacterEncoding("utf-8");
		try {
			request.setCharacterEncoding("utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}
		ClientInfoForm clientInfoForm = (ClientInfoForm) form;
		ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
		String appointPage = clientInfoForm.getAppointPage();
		
		pageBean.setPageSize(20);
		int total = clientInfoDao.getTotalRecordAllClient();
		pageBean.setTotalRecoder(total);
		if(appointPage == null || appointPage.equals("")){
			String currentPage = request.getParameter("currentPage");
			if(currentPage == null){
				pageBean.setCurrentPage(1);
			}else{
				pageBean.setCurrentPage(Integer.valueOf(currentPage));
			}
			int start = pageBean.getStart();
			saveToken(request);
			clientInfoList = (ArrayList<ClientInfo>) clientInfoDao.showAllMenberClientInfo(start-1);
		}else if((Integer.parseInt(appointPage) <= 0)){
			String currentPage = request.getParameter("currentPage");
			if(currentPage == null){
				pageBean.setCurrentPage(1);
			}else{
				pageBean.setCurrentPage(Integer.valueOf(currentPage));
			}
			int start = pageBean.getStart();
			saveToken(request);
			clientInfoList = (ArrayList<ClientInfo>) clientInfoDao.showAllMenberClientInfo(start-1);
		}else{
			if(total >= (Integer.parseInt(appointPage)-1) * 5){
				pageBean.setCurrentPage(Integer.parseInt(appointPage));
				int start = pageBean.getStart();
				clientInfoList = (ArrayList<ClientInfo>) clientInfoDao.showAllMenberClientInfo(start-1);
			}else{
				String currentPage=null;
				if(total%pageBean.getPageSize() == 0){
					currentPage =""+ total/pageBean.getPageSize();
				}else{
					currentPage =""+ (total/pageBean.getPageSize() + 1);	
				}
				if(currentPage == null){
					pageBean.setCurrentPage(1);
				}else{
					pageBean.setCurrentPage(Integer.valueOf(currentPage));
				}
				int start = pageBean.getStart();
				saveToken(request);
				clientInfoList = (ArrayList<ClientInfo>) clientInfoDao.showAllMenberClientInfo(start-1);
			}
			
			
		}
		request.setAttribute("pageBean", pageBean);
		request.setAttribute("clientInfoList",clientInfoList);
		return mapping.findForward("showAllClientInfo");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -