📄 setexamaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.dcs.struts.action;
import java.util.Date;
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.dcs.hibernate.Exams;
import com.dcs.hibernate.ExamsDAO;
import com.dcs.struts.form.SetexamForm;
/**
* MyEclipse Struts Creation date: 09-07-2007
*
* XDoclet definition:
*
* @struts.action path="/setexam" name="setexamForm"
* input="/setkaochang/set_examtype.jsp" scope="request"
* validate="true"
* @struts.action-forward name="success" path="/success.jsp"
* @struts.action-forward name="fail" path="/fail.jsp"
*/
public class SetexamAction extends Action {
/*
* Generated Methods
*/
/**
* Method execute
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
try {
SetexamForm setexamForm = (SetexamForm) form;
String examNo = setexamForm.getExamNo();
String examItem = setexamForm.getExamItem();
String examType = setexamForm.getExamType();
Exams exam = new Exams(examNo, examItem, examType, new Date());
ExamsDAO examDAO = new ExamsDAO();
examDAO.save(exam);
return mapping.findForward("success");
} catch (Exception e) {
return mapping.findForward("fail");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -