⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addcourseaction.java

📁 这是一个用Struts+Hibernate+Tomcat5.5.9实现的一个“课程管理系统”
💻 JAVA
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.0/xslt/JavaClass.xslpackage struts.action;import hibernate.Course;import hibernate.HibernateUtil;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 struts.Constants;import struts.form.AddCourseForm;/** * MyEclipse Struts Creation date: 11-12-2005 *  * XDoclet definition: *  * @struts.action path="/addCourse" name="addCourseForm" input="addCourse.jsp" *                scope="request" validate="true" * @struts.action-forward name="success" path="/getCourse.jsp" */public class AddCourseAction extends Action {	// --------------------------------------------------------- Instance	// Variables	// --------------------------------------------------------- Methods	/**	 * Method execute	 * 	 * @param mapping	 * @param form	 * @param request	 * @param response	 * @return ActionForward	 */	public ActionForward execute(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response) {		AddCourseForm addCourseForm = (AddCourseForm) form;		String develop = null;		String prepare = null;		String courseID = null;		String name = null;		Integer mark = null;        		try{		if (addCourseForm != null) {			develop = new String((addCourseForm.getDevelop()).getBytes("ISO-8859-1"));			prepare = new String((addCourseForm.getPrepare()).getBytes("ISO-8859-1"));			courseID = addCourseForm.getCourseID();			name = new String((addCourseForm.getName()).getBytes("ISO-8859-1"));			mark = addCourseForm.getMark();		}				Course course = new Course(courseID, name, mark, prepare, develop);		HibernateUtil.save(course);				}catch(Exception e){}		return (mapping.findForward(Constants.FORWARD_SUCCESS));	}}

⌨️ 快捷键说明

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