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

📄 modistudentaction.java

📁 通过此代码可实现 学生信息的增删改查
💻 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 ModiStudentAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try{
			StudentForm studentForm=(StudentForm)form;
	
		Student student=new Student();
		student.setStudId(new Integer(request.getParameter("studId")));
		student.setStudName(studentForm.getName().trim());
		student.setStudAge(new Integer(studentForm.getAge().trim()));
		student.setStudPwd(studentForm.getPassword().trim());
		student.setStudSex(studentForm.getSex().trim());
		student.setStudCol(studentForm.getCol().trim());
		student.setStudClass(studentForm.getClas());
		
		IStudentService service = (IStudentService) getBean("studentService");
		service.modiStudent(student);
		}catch(Exception ex){
			System.out.println("【系统错误】在ModiUserAction中出错,原因是:");
			ex.printStackTrace();
		}
		return new ActionForward("/index.jsp");
	}
}

⌨️ 快捷键说明

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