popedomaction.java

来自「spring+hibernate+struts开发的校务oa系统」· Java 代码 · 共 85 行

JAVA
85
字号
package com.yondor.oa.webapp.admin.popedom;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.GenericValidator;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.displaytag.tags.TableTagParameters;
import org.displaytag.util.ParamEncoder;

import com.yondor.oa.common.constant.ForwardType;
import com.yondor.oa.common.constant.Property;
import com.yondor.oa.common.utils.BeanManage;
import com.yondor.oa.common.utils.PageList;
import com.yondor.oa.common.utils.PageTool;
import com.yondor.oa.db.popedom.dao.PopedomVO;
import com.yondor.oa.db.usergroup.dao.UsergroupVO;
import com.yondor.oa.webapp.admin.usergroup.UserGroupAF;
import com.yondor.oa.webapp.base.BaseDisPatchAction;
import com.yondor.oa.webapp.example.ExampleAction;

public class PopedomAction extends BaseDisPatchAction{
	private static final Log log = LogFactory.getLog(PopedomAction.class);

	public ActionForward doSave(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PopedomAF af=(PopedomAF)form;
		PopedomVO vo=new PopedomVO();
		BeanManage.simpleCopy(af, vo);
		getIpopedomService().save(vo);
		return mapping.findForward(ForwardType.DOSAVE);
	}

	public ActionForward doView(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		int pageSize=5;

		int pageIndex=PageTool.getPageIndex("list", request, response);
		int pageResultSize=getIpopedomService().findAll().size();
		List popedomList=getIpopedomService().findSegment(pageIndex*5, pageSize);
		
		PageList pageList=new PageList();
		pageList.setFullListSize(pageResultSize);
		pageList.setObjectsPerPage(pageSize);
		pageList.setList(popedomList);
		
		log.info("popedomList:"+popedomList.size());
		request.setAttribute(Property.POPEDOMLIST, popedomList);
		request.setAttribute(Property.PAGELIST, pageList);
		return mapping.findForward(ForwardType.DOVIEW);
	}

	public ActionForward doEdit(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PopedomAF af=(PopedomAF)form;
		PopedomVO vo=getIpopedomService().findById(af.getId());
		BeanManage.simpleCopy(af, vo);
		getIpopedomService().attachDirty(vo);
		return mapping.findForward(ForwardType.DOEDIT);
	}

	public ActionForward doDelete(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PopedomAF af=(PopedomAF)form;
		PopedomVO vo=getIpopedomService().findById(af.getId());
		getIpopedomService().delete(vo);
		return mapping.findForward(ForwardType.DODELETE);
	}
}

⌨️ 快捷键说明

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