📄 loadstudentaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.jinshi.struts.action;
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 com.jinshi.struts.bean.Student;
import com.jinshi.struts.form.StudentForm;
import com.jinshi.struts.service.IStudentService;
public class LoadStudentAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
StudentForm studentForm = new StudentForm();
// 新建一个数据库访问代理
IStudentService service = (IStudentService) getBean("studentService");
// 装载指定ID的持久化对象
Integer id = new Integer(request.getParameter("id"));
Student student = service.loadStudent(id);
studentForm.setName(student.getStudName().trim());
studentForm.setAge(String.valueOf(student.getStudAge()));
studentForm.setClas(student.getStudClass().trim());
studentForm.setPassword(student.getStudPwd().trim());
studentForm.setSex(student.getStudSex().trim());
studentForm.setCol(student.getStudCol().trim());
request.setAttribute("student", student);
request.setAttribute("studentForm", studentForm);
return new ActionForward("/modiStudent.jsp");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -