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

📄 findclientinfobyclientnameaction.java

📁 一个oa系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.oa.crm.publicClient.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: 08-27-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action validate="true"
 */
public class FindClientInfoByClientNameAction extends Action {
	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	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
		ClientInfoForm clientInfoForm = (ClientInfoForm) form;
		String clientName1 = null;
		ArrayList<ClientInfo> clientInfoList = new ArrayList<ClientInfo>();
		if (clientInfoForm.getClientName() != null) {
			clientName1 = clientInfoForm.getClientName();
			request.getSession().setAttribute("clientName1", clientName1);
		} else {
			clientName1 = request.getSession().getAttribute("clientName1").toString();
		}
		String clientName = null;
		try {
			clientName = new String(clientName1.getBytes("iso-8859-1"), "gbk");
		} catch (UnsupportedEncodingException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}
		int total = clientInfoDao.getTotalRecordByClientName(clientName);
		pageBean.setPageSize(5);
		pageBean.setTotalRecoder(total);
		String appointPage = clientInfoForm.getAppointPage();
		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.showMenberClientInfoByName(start - 1, 5, clientName);
		} 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.showMenberClientInfoByName(start - 1, 5, clientName);
		} else {
			if (total >= (Integer.parseInt(appointPage) - 1) * 5) {
				pageBean.setCurrentPage(Integer.parseInt(appointPage));
				int start = pageBean.getStart();
				clientInfoList = (ArrayList<ClientInfo>) clientInfoDao.showMenberClientInfoByName(start - 1, 5, clientName);
			} 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.showMenberClientInfoByName(start - 1, 5, clientName);
			}

		}
		request.setAttribute("clientInfoList", clientInfoList);
		request.setAttribute("pageBean", pageBean);
		return mapping.findForward("showClientInfoByClientName");
	}
}

⌨️ 快捷键说明

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