adminexamaction.java
来自「在线考试功能」· Java 代码 · 共 60 行
JAVA
60 行
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.onlinestudy.action.teacher;
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 org.apache.struts.actions.DispatchAction;
import com.onlinestudy.domain.Exam;
import com.onlinestudy.service.ExamService;
/**
* MyEclipse Struts
* Creation date: 04-05-2009
*
* XDoclet definition:
* @struts.action parameter="status" validate="true"
*/
public class AdminExamAction extends DispatchAction {
ExamService examService;
//增加试卷
public ActionForward addExam(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
String title = new String(request.getParameter("title").trim().getBytes("ISO8859-1"),"GBK");
int limitTime = Integer.parseInt(request.getParameter("time"));
Exam exam = new Exam();
exam.setTitle(title);
exam.setLimitTime(limitTime);
exam.setIssue("否");
exam.setBuildTime(new java.util.Date());
examService.addExam(exam);
request.getRequestDispatcher("showExam.do?status=showExam").forward(request, response);
return null;
}
//删除试卷
public ActionForward deleteExam(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
int id = Integer.parseInt(request.getParameter("id"));
examService.deleteExam(id);
request.getRequestDispatcher("showExam.do?status=showExam").forward(request, response);
return null;
}
public void setExamService(ExamService examService) {
this.examService = examService;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?