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

📄 editstudent.java

📁 jsp例程
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package struts;

import java.io.UnsupportedEncodingException;

import hibernate.Student;

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 dao.StudentDAO;

/** 
 * MyEclipse Struts
 * Creation date: 04-09-2007
 * 
 * XDoclet definition:
 * @struts.action path="/editStudent" name="studentForm" input="/updatestu.jsp" scope="request" validate="true"
 * @struts.action-forward name="success" path="/getStudent.jsp"
 */
public class EditStudent extends Action {
	private StudentDAO stuDao;
	private Student stu;

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		StudentForm studentForm = (StudentForm) form;// TODO Auto-generated method stub
		//String id=(String)request.getParameter("student_id");
		String id=studentForm.getId();
		stu=stuDao.getStudentByID(id);
	
		stu.setSex(studentForm.getSex());
		
		stu.setName(studentForm.getName());
		stu.setPassword(studentForm.getPassword());
		
		stu.setDepartment(studentForm.getDepartment());
		
		
			
		stu.setJiguan(studentForm.getJiguan());
			
		
		if(stuDao.updateStudent(stu))
		{
		  return mapping.findForward("success");
		  
		}
		else{
			return mapping.getInputForward();
		}
	}
	public StudentDAO getStuDao() {
		return stuDao;
	}

	public void setStuDao(StudentDAO stuDao) {
		this.stuDao = stuDao;
	}
}

⌨️ 快捷键说明

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