📄 adminexamaction.java
字号:
/*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -