examcontentaction.java

来自「这是一个用java三层框架做的ISS学员管理系统」· Java 代码 · 共 102 行

JAVA
102
字号
package com.isoftstone.isscrmweb.web.struts.exam;

import java.util.ArrayList;
import java.util.List;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.isoftstone.isscrmweb.web.struts.AbstractDynamicAction;
import org.pontifex.util.StringUtil;
import com.isoftstone.isscrmweb.web.logic.exam.ExamKindLogic;
import com.isoftstone.isscrmweb.web.mapping.*;

public class ExamContentAction extends AbstractDynamicAction{
	public ExamKindLogic examKindLogic;
	
	public void setExamKindLogic(ExamKindLogic examKindLogic) {
		this.examKindLogic = examKindLogic;
	}
	
	//类型列表
	public ActionForward getExamContentList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Examkind examKind = (Examkind)fillBean(Examkind.class);
//		if(request.getParameter("kindname")!=null && request.getParameter("kindname")!=""){
//			String kindName = request.getParameter("kindname") ;
//			examKind.setKindname(kindName);
//		}
//		if(request.getParameter("maxpoint")!=null && request.getParameter("maxpoint")!=""){
//			Long maxpoint = Long.parseLong(request.getParameter("maxpoint"));
//			examKind.setMaxpoint(maxpoint);
//		}
		examKind.setPerPageRows(16);
		request.setAttribute("pageInfo", examKindLogic.getExamContentList(examKind));
		return mapping.findForward("examContentList");
	}
	
	//用于选择类型的摸态窗口
	public ActionForward checkExamKind(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Examkind examKind = (Examkind)fillBean(Examkind.class);
		examKind.setPerPageRows(10);
		request.setAttribute("pageInfo", examKindLogic.getExamContentList(examKind));
		return mapping.findForward("chooseKind");
	}
	//添加类型初始化,转到添加页面
	public ActionForward addEKindInit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		return mapping.findForward("addEKind");
	}
	
	//添加类型
	public ActionForward addEKind(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Examkind examKind = (Examkind)fillBean(Examkind.class);
		examKind.setKindid(StringUtil.getPrimaryKey());
		examKindLogic.saveEKind(examKind);
		List list_src = new ArrayList();
		list_src.add(makeHref("examContent.do?method=getExamContentList","返回类型列表"));
		return viewAndSuccess("添加成功!", list_src);
	}
	
	//修改类型初始化,转到修改页面
	public ActionForward updateEKindInit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Examkind examKind = (Examkind)fillBean(Examkind.class);
		request.setAttribute("examKind",examKind);
		return mapping.findForward("updateEKind");
	}
	
	//修改类型
	public ActionForward updateEKind(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		Examkind examKind = (Examkind)fillBean(Examkind.class);
		examKindLogic.updateEKind(examKind);
		List list_src = new ArrayList();
		list_src.add(makeHref("examContent.do?method=getExamContentList","返回类型列表"));
		return viewAndSuccess("修改成功!", list_src);
	}
	
	//删除类型
	public ActionForward deleteEKind(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		List list_src = new ArrayList();
		list_src.add(makeHref("examContent.do?method=getExamContentList","返回类型列表"));
		return viewAndSuccess("删除成功!", list_src);
	}

	
}

⌨️ 快捷键说明

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