首页>代码>javaweb+layui毕业设计学生管理系统>/毕业设计管理子系统v2.0/src/com/sxh/controller/EditStudent.java
package com.sxh.controller;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sxh.dao.editDao;
import com.sxh.dao.editDaoImpl;
import com.sxh.pojo.Student;
import com.sxh.pojo.Teacher;

/**
 * Servlet implementation class EditStudent
 */
@WebServlet("/EditStudent")
public class EditStudent extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public EditStudent() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 request.setCharacterEncoding("utf-8");
		  response.setCharacterEncoding("utf-8");
		  response.setContentType("text/html;charset=utf-8");
		  String studentId=request.getParameter("studentId");
		  String name=request.getParameter("name");
		  String age=request.getParameter("age");
		  String sex=request.getParameter("sex");
		  String teacherId=request.getParameter("teacherId");
		  String grade=request.getParameter("grade");
		  String clazz=request.getParameter("clazz");
		  String titleId=request.getParameter("titleId");
		  
		 
		  int titleId1=Integer.parseInt(titleId);
		 

		  int grade1=Integer.parseInt(grade);
		  int age1=Integer.parseInt(age);
		  Student student=new Student();
		  student.setStudentId(studentId);
		  student.setAge(age1);
		  student.setClazz(clazz);
		  student.setGrade(grade1);
		  student.setName(name);
		  student.setSex(sex);
		  student.setTeacherId(teacherId);
		  student.setTitleId(titleId1);
		  
		  editDao editDao=new editDaoImpl();
		  try {
			if(editDao.EditStudent(student)==1) {
				  response.getWriter().write("success");
			  }
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
最近下载更多
zeng1206  LV5 2023年12月26日
蹇金金  LV7 2023年11月6日
刘洋66666  LV1 2023年10月3日
微信网友_6625276664238080  LV1 2023年8月28日
jhmajxb  LV3 2023年5月27日
不停的奔跑  LV20 2023年4月23日
kk1031  LV8 2023年4月13日
彩色天空  LV5 2023年4月8日
chen_jw  LV10 2023年2月19日
最近浏览更多
钝感力  LV1 3月14日
呵呵喝  LV4 3月11日
潘潘123456  LV2 3月2日
WBelong  LV7 2023年12月25日
zeng1206  LV5 2023年12月25日
微信网友_6786215447367680  LV4 2023年12月20日
yuanshun  LV6 2023年12月19日
微信网友_6200582435409920 2023年12月15日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友